import*as t from"../root/root.js";import*as e from"../platform/platform.js";export{UIString}from"../platform/platform.js";import*as r from"../i18n/i18n.js";var s=Object.freeze({__proto__:null});const n=[];var i=Object.freeze({__proto__:null,registerAppProvider:function(t){n.push(t)},getRegisteredAppProviders:function(){return n.filter((e=>t.Runtime.Runtime.isDescriptorEnabled({experiment:void 0,condition:e.condition}))).sort(((t,e)=>(t.order||0)-(e.order||0)))}});const a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=new Uint8Array(123);for(let t=0;t<a.length;++t)o[a.charCodeAt(t)]=t;var l=Object.freeze({__proto__:null,decode:function(t){let e=3*t.length/4>>>0;61===t.charCodeAt(t.length-2)?e-=2:61===t.charCodeAt(t.length-1)&&(e-=1);const r=new Uint8Array(e);for(let e=0,s=0;e<t.length;e+=4){const n=o[t.charCodeAt(e+0)],i=o[t.charCodeAt(e+1)],a=o[t.charCodeAt(e+2)],l=o[t.charCodeAt(e+3)];r[s++]=n<<2|i>>4,r[s++]=(15&i)<<4|a>>2,r[s++]=(3&a)<<6|63&l}return r.buffer}});var h=Object.freeze({__proto__:null,CharacterIdMap:class{#t;#e;#r;constructor(){this.#t=new Map,this.#e=new Map,this.#r=33}toChar(t){let e=this.#t.get(t);if(!e){if(this.#r>=65535)throw new Error("CharacterIdMap ran out of capacity!");e=String.fromCharCode(this.#r++),this.#t.set(t,e),this.#e.set(e,t)}return e}fromChar(t){const e=this.#e.get(t);return void 0===e?null:e}}});class c{values=[0,0,0];constructor(t){t&&(this.values=t)}}class u{values=[[0,0,0],[0,0,0],[0,0,0]];constructor(t){t&&(this.values=t)}multiply(t){const e=new c;for(let r=0;r<3;++r)e.values[r]=this.values[r][0]*t.values[0]+this.values[r][1]*t.values[1]+this.values[r][2]*t.values[2];return e}}class g{g;a;b;c;d;e;f;constructor(t,e,r=0,s=0,n=0,i=0,a=0){this.g=t,this.a=e,this.b=r,this.c=s,this.d=n,this.e=i,this.f=a}eval(t){const e=t<0?-1:1,r=t*e;return r<this.d?e*(this.c*r+this.f):e*(Math.pow(this.a*r+this.b,this.g)+this.e)}}const d={sRGB:new g(2.4,1/1.055,.055/1.055,1/12.92,.04045,0,0),sRGB_INVERSE:new g(.416667,1.13728,-0,12.92,.0031308,-.0549698,-0),proPhotoRGB:new g(1.8,1),proPhotoRGB_INVERSE:new g(.555556,1,-0,0,0,0,0),k2Dot2:new g(2.2,1),k2Dot2_INVERSE:new g(.454545,1),rec2020:new g(2.22222,.909672,.0903276,.222222,.0812429,0,0),rec2020_INVERSE:new g(.45,1.23439,-0,4.5,.018054,-.0993195,-0)},p={sRGB:new u([[.436065674,.385147095,.143066406],[.222488403,.716873169,.06060791],[.013916016,.097076416,.714096069]]),sRGB_INVERSE:new u([[3.134112151374599,-1.6173924597114966,-.4906334036481285],[-.9787872938826594,1.9162795854799963,.0334547139520088],[.07198304248352326,-.2289858493321844,1.4053851325241447]]),displayP3:new u([[.515102,.291965,.157153],[.241182,.692236,.0665819],[-.00104941,.0418818,.784378]]),displayP3_INVERSE:new u([[2.404045155982687,-.9898986932663839,-.3976317191366333],[-.8422283799266768,1.7988505115115485,.016048170293157416],[.04818705979712955,-.09737385156228891,1.2735066448052303]]),adobeRGB:new u([[.60974,.20528,.14919],[.31111,.62567,.06322],[.01947,.06087,.74457]]),adobeRGB_INVERSE:new u([[1.9625385510109137,-.6106892546501431,-.3413827467482388],[-.9787580455521,1.9161624707082339,.03341676594241408],[.028696263137883395,-.1406807819331586,1.349252109991369]]),rec2020:new u([[.673459,.165661,.1251],[.279033,.675338,.0456288],[-.00193139,.0299794,.797162]]),rec2020_INVERSE:new u([[1.647275201661012,-.3936024771460771,-.23598028884792507],[-.6826176165196962,1.647617775014935,.01281626807852422],[.029662725298529837,-.06291668721366285,1.2533964313435522]]),xyz:new u([[1,0,0],[0,1,0],[0,0,1]])};function m(t){return t*(Math.PI/180)}function y(t,e,r,s){return[t.eval(e),t.eval(r),t.eval(s)]}const f=new u([[.9999999984505198,.39633779217376786,.2158037580607588],[1.0000000088817609,-.10556134232365635,-.06385417477170591],[1.0000000546724108,-.08948418209496575,-1.2914855378640917]]),w=new u([[.2104542553,.7936177849999999,-.0040720468],[1.9779984951000003,-2.4285922049999997,.4505937099000001],[.025904037099999982,.7827717662,-.8086757660000001]]),b=new u([[.8190224432164319,.3619062562801221,-.12887378261216414],[.0329836671980271,.9292868468965546,.03614466816999844],[.048177199566046255,.26423952494422764,.6335478258136937]]),S=new u([[1.226879873374156,-.5578149965554814,.2813910501772159],[-.040575762624313734,1.1122868293970596,-.07171106666151703],[-.07637294974672144,-.4214933239627915,1.586924024427242]]),x=new u([[.7976700747153241,.13519395152800417,.03135596341127167],[.28803902352472205,.7118744007923554,8661179538844252e-20],[2.739876695467402e-7,-14405226518969991e-22,.825211112593861]]),T=new u([[1.3459533710138858,-.25561367037652133,-.051116041522131374],[-.544600415668951,1.5081687311475767,.020535163968720935],[-13975622054109725e-22,2717590904589903e-21,1.2118111696814942]]),R=new u([[1.0478573189120088,.022907374491829943,-.050162247377152525],[.029570500050499514,.9904755577034089,-.017061518194840468],[-.00924047197558879,.015052921526981566,.7519708530777581]]),v=new u([[.9555366447632887,-.02306009252137888,.06321844147263304],[-.028315378228764922,1.009951351591575,.021026001591792402],[.012308773293784308,-.02050053471777469,1.3301947294775631]]),z=new u([[3.2408089365140573,-1.5375788839307314,-.4985609572551541],[-.9692732213205414,1.876110235238969,.041560501141251774],[.05567030990267439,-.2040007921971802,1.0571046720577026]]);class A{static labToXyzd50(t,e,r){let s=(t+16)/116,n=s+e/500,i=s-r/200;function a(t){return t<=24/116?108/841*(t-16/116):t*t*t}return n=.9642*a(n),s=1*a(s),i=.8251*a(i),[n,s,i]}static xyzd50ToLab(t,e,r){function s(t){return t<=.008856451679035631?841/108*t+16/116:Math.pow(t,1/3)}t=s(t/.9642);return[116*(e=s(e/1))-16,500*(t-e),200*(e-(r=s(r/.8251)))]}static oklabToXyzd65(t,e,r){const s=new c([t,e,r]),n=f.multiply(s);n.values[0]=n.values[0]*n.values[0]*n.values[0],n.values[1]=n.values[1]*n.values[1]*n.values[1],n.values[2]=n.values[2]*n.values[2]*n.values[2];return S.multiply(n).values}static xyzd65ToOklab(t,e,r){const s=new c([t,e,r]),n=b.multiply(s);n.values[0]=Math.pow(n.values[0],1/3),n.values[1]=Math.pow(n.values[1],1/3),n.values[2]=Math.pow(n.values[2],1/3);const i=w.multiply(n);return[i.values[0],i.values[1],i.values[2]]}static lchToLab(t,e,r){return void 0===r?[t,0,0]:[t,e*Math.cos(m(r)),e*Math.sin(m(r))]}static labToLch(t,e,r){return[t,Math.sqrt(e*e+r*r),(s=Math.atan2(r,e),s*(180/Math.PI))];var s}static displayP3ToXyzd50(t,e,r){const[s,n,i]=y(d.sRGB,t,e,r),a=new c([s,n,i]);return p.displayP3.multiply(a).values}static xyzd50ToDisplayP3(t,e,r){const s=new c([t,e,r]),n=p.displayP3_INVERSE.multiply(s);return y(d.sRGB_INVERSE,n.values[0],n.values[1],n.values[2])}static proPhotoToXyzd50(t,e,r){const[s,n,i]=y(d.proPhotoRGB,t,e,r),a=new c([s,n,i]);return x.multiply(a).values}static xyzd50ToProPhoto(t,e,r){const s=new c([t,e,r]),n=T.multiply(s);return y(d.proPhotoRGB_INVERSE,n.values[0],n.values[1],n.values[2])}static adobeRGBToXyzd50(t,e,r){const[s,n,i]=y(d.k2Dot2,t,e,r),a=new c([s,n,i]);return p.adobeRGB.multiply(a).values}static xyzd50ToAdobeRGB(t,e,r){const s=new c([t,e,r]),n=p.adobeRGB_INVERSE.multiply(s);return y(d.k2Dot2_INVERSE,n.values[0],n.values[1],n.values[2])}static rec2020ToXyzd50(t,e,r){const[s,n,i]=y(d.rec2020,t,e,r),a=new c([s,n,i]);return p.rec2020.multiply(a).values}static xyzd50ToRec2020(t,e,r){const s=new c([t,e,r]),n=p.rec2020_INVERSE.multiply(s);return y(d.rec2020_INVERSE,n.values[0],n.values[1],n.values[2])}static xyzd50ToD65(t,e,r){const s=new c([t,e,r]);return v.multiply(s).values}static xyzd65ToD50(t,e,r){const s=new c([t,e,r]);return R.multiply(s).values}static xyzd65TosRGBLinear(t,e,r){const s=new c([t,e,r]);return z.multiply(s).values}static xyzd50TosRGBLinear(t,e,r){const s=new c([t,e,r]);return p.sRGB_INVERSE.multiply(s).values}static srgbLinearToXyzd50(t,e,r){const s=new c([t,e,r]);return p.sRGB.multiply(s).values}static srgbToXyzd50(t,e,r){const[s,n,i]=y(d.sRGB,t,e,r),a=new c([s,n,i]);return p.sRGB.multiply(a).values}static xyzd50ToSrgb(t,e,r){const s=new c([t,e,r]),n=p.sRGB_INVERSE.multiply(s);return y(d.sRGB_INVERSE,n.values[0],n.values[1],n.values[2])}static oklchToXyzd50(t,e,r){const[s,n,i]=A.lchToLab(t,e,r),[a,o,l]=A.oklabToXyzd65(s,n,i);return A.xyzd65ToD50(a,o,l)}static xyzd50ToOklch(t,e,r){const[s,n,i]=A.xyzd50ToD65(t,e,r),[a,o,l]=A.xyzd65ToOklab(s,n,i);return A.labToLch(a,o,l)}}var I=Object.freeze({__proto__:null,ColorConverter:A});function P(t,e){const r=t[3];return[(1-r)*e[0]+r*t[0],(1-r)*e[1]+r*t[1],(1-r)*e[2]+r*t[2],r+e[3]*(1-r)]}function E([t,e,r]){const s=Math.max(t,e,r),n=Math.min(t,e,r),i=s-n;let a;return a=n===s?0:t===s?(1/6*(e-r)/i+1)%1:e===s?1/6*(r-t)/i+1/3:1/6*(t-e)/i+2/3,a}function k(t){const[e,r,s]=L([...t,void 0]);return[e,r,s]}function L([t,e,r,s]){const n=Math.max(t,e,r),i=Math.min(t,e,r),a=n-i,o=n+i,l=.5*o;let h;return h=0===l||1===l?0:l<=.5?a/o:a/(2-o),[E([t,e,r]),h,l,s]}function B(t){const[e,r,s]=O([...t,void 0]);return[e,r,s]}function O([t,e,r,s]){const n=E([t,e,r]),i=Math.max(t,e,r);return[n,Math.min(t,e,r),1-i,s]}function C([t,e,r]){return.2126*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.0722*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))}function N([t,e,r]){return.2126729*Math.pow(t,2.4)+.7151522*Math.pow(e,2.4)+.072175*Math.pow(r,2.4)}function G(t,e){return V(N(P(t,e)),N(e))}function _(t){return t>.022?t:t+Math.pow(.022-t,1.414)}function V(t,e){if(t=_(t),e=_(e),Math.abs(t-e)<5e-4)return 0;let r=0;return e>t?(r=1.14*(Math.pow(e,.56)-Math.pow(t,.57)),r=r<.1?0:r-.027):(r=1.14*(Math.pow(e,.65)-Math.pow(t,.62)),r=r>-.1?0:r+.027),100*r}function M(t,e,r){function s(){return r?Math.pow(Math.abs(Math.pow(t,.65)-(-e-.027)/1.14),1/.62):Math.pow(Math.abs(Math.pow(t,.56)-(e+.027)/1.14),1/.57)}t=_(t),e/=100;let n=s();return(n<0||n>1)&&(r=!r,n=s()),n}const W=[[12,-1,-1,-1,-1,100,90,80,-1,-1],[14,-1,-1,-1,100,90,80,60,60,-1],[16,-1,-1,100,90,80,60,55,50,50],[18,-1,-1,90,80,60,55,50,40,40],[24,-1,100,80,60,55,50,40,38,35],[30,-1,90,70,55,50,40,38,35,40],[36,-1,80,60,50,40,38,35,30,25],[48,100,70,55,40,38,35,30,25,20],[60,90,60,50,38,35,30,25,20,20],[72,80,55,40,35,30,25,20,20,20],[96,70,50,35,30,25,20,20,20,20],[120,60,40,30,25,20,20,20,20,20]];function X(t,e){const r=72*parseFloat(t.replace("px",""))/96;return(isNaN(Number(e))?["bold","bolder"].includes(e):Number(e)>=600)?r>=14:r>=18}W.reverse();const F={aa:3,aaa:4.5},D={aa:4.5,aaa:7};var U=Object.freeze({__proto__:null,blendColors:P,rgbToHsl:k,rgbaToHsla:L,rgbToHwb:B,rgbaToHwba:O,luminance:C,contrastRatio:function(t,e){const r=C(P(t,e)),s=C(e);return(Math.max(r,s)+.05)/(Math.min(r,s)+.05)},luminanceAPCA:N,contrastRatioAPCA:G,contrastRatioByLuminanceAPCA:V,desiredLuminanceAPCA:M,getAPCAThreshold:function(t,e){const r=parseFloat(t.replace("px","")),s=parseFloat(e);for(const[t,...e]of W)if(r>=t)for(const[t,r]of[900,800,700,600,500,400,300,200,100].entries())if(s>=r){const r=e[e.length-1-t];return-1===r?null:r}return null},isLargeFont:X,getContrastThreshold:function(t,e){return X(t,e)?F:D}});function j(t){return(t%360+360)%360}function $(t){const e=t.replace(/(deg|g?rad|turn)$/,"");if(isNaN(e)||t.match(/\s+(deg|g?rad|turn)/))return null;const r=parseFloat(e);return t.includes("turn")?360*r:t.includes("grad")?9*r/10:t.includes("rad")?180*r/Math.PI:r}function H(t){switch(t){case"srgb":return"srgb";case"srgb-linear":return"srgb-linear";case"display-p3":return"display-p3";case"a98-rgb":return"a98-rgb";case"prophoto-rgb":return"prophoto-rgb";case"rec2020":return"rec2020";case"xyz":return"xyz";case"xyz-d50":return"xyz-d50";case"xyz-d65":return"xyz-d65"}return null}function q(t,e){const r=Math.sign(t),s=Math.abs(t),[n,i]=e;return r*(s*(i-n)/100+n)}function Y(t,{min:e,max:r}){return null===t||(void 0!==e&&(t=Math.max(t,e)),void 0!==r&&(t=Math.min(t,r))),t}function Z(t,e){if(!t.endsWith("%"))return null;const r=parseFloat(t.substr(0,t.length-1));return isNaN(r)?null:q(r,e)}function K(t){const e=parseFloat(t);return isNaN(e)?null:e}function J(t){return void 0===t?null:Y(Z(t,[0,1])??K(t),{min:0,max:1})}function Q(t,e=[0,1]){if(isNaN(t.replace("%","")))return null;const r=parseFloat(t);return-1!==t.indexOf("%")?t.indexOf("%")!==t.length-1?null:q(r,e):r}function tt(t){const e=Q(t);return null===e?null:-1!==t.indexOf("%")?e:e/255}function et(t){const e=t.replace(/(deg|g?rad|turn)$/,"");if(isNaN(e)||t.match(/\s+(deg|g?rad|turn)/))return null;const r=parseFloat(e);return-1!==t.indexOf("turn")?r%1:-1!==t.indexOf("grad")?r/400%1:-1!==t.indexOf("rad")?r/(2*Math.PI)%1:r/360%1}function rt(t){if(t.indexOf("%")!==t.length-1||isNaN(t.replace("%","")))return null;return parseFloat(t)/100}function st(t,e){const r=t[0];let s=t[1];const n=t[2];function i(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}let a;s<0&&(s=0),a=n<=.5?n*(1+s):n+s-n*s;const o=2*n-a,l=r+1/3,h=r,c=r-1/3;e[0]=i(o,a,l),e[1]=i(o,a,h),e[2]=i(o,a,c),e[3]=t[3]}function nt(t,e){const r=[0,0,0,0];!function(t,e){const r=t[0];let s=t[1];const n=t[2],i=(2-s)*n;0===n||0===s?s=0:s*=n/(i<1?i:2-i),e[0]=r,e[1]=s,e[2]=i/2,e[3]=t[3]}(t,r),st(r,e)}function it(t,e,r){function s(){return r?(t+.05)*e-.05:(t+.05)/e-.05}let n=s();return(n<0||n>1)&&(r=!r,n=s()),n}function at(t,e,r,s,n){let i=t[r],a=1,o=n(t)-s,l=Math.sign(o);for(let e=100;e;e--){if(Math.abs(o)<2e-4)return t[r]=i,i;const e=Math.sign(o);if(e!==l)a/=2,l=e;else if(i<0||i>1)return null;i+=a*(2===r?-o:o),t[r]=i,o=n(t)-s}return null}function ot(t,e,r=.01){if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(const r in t)if(!ot(t[r],e[r]))return!1;return!0}return!Array.isArray(t)&&!Array.isArray(e)&&(null===t||null===e?t===e:Math.abs(t-e)<r)}function lt(t,e,r=.01){return t-e<=r}class ht{l;a;b;alpha;#s;#n;static#i={nickname:t=>new ft(t.#a(!1),"nickname"),hex:t=>new ft(t.#a(!1),"hex"),shorthex:t=>new ft(t.#a(!1),"shorthex"),hexa:t=>new ft(t.#a(!0),"hexa"),shorthexa:t=>new ft(t.#a(!0),"shorthexa"),rgb:t=>new ft(t.#a(!1),"rgb"),rgba:t=>new ft(t.#a(!0),"rgba"),hsl:t=>new pt(...k(t.#a(!1)),t.alpha),hsla:t=>new pt(...k(t.#a(!1)),t.alpha),hwb:t=>new mt(...B(t.#a(!1)),t.alpha),hwba:t=>new mt(...B(t.#a(!1)),t.alpha),lch:t=>new ct(...A.labToLch(t.l,t.a,t.b),t.alpha),oklch:t=>new gt(...A.xyzd50ToOklch(...t.#o()),t.alpha),lab:t=>t,oklab:t=>new ut(...A.xyzd65ToOklab(...A.xyzd50ToD65(...t.#o())),t.alpha),srgb:t=>new dt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new dt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new dt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new dt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new dt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new dt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new dt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new dt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new dt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#o(){return A.labToXyzd50(this.l,this.a,this.b)}#a(t=!0){const e=A.xyzd50ToSrgb(...this.#o());return t?[...e,this.alpha??void 0]:e}constructor(t,e,r,s,n){this.#n=[t,e,r],this.l=Y(t,{min:0,max:100}),(ot(this.l,0,1)||ot(this.l,100,1))&&(e=r=0),this.a=e,this.b=r,this.alpha=Y(s,{min:0,max:1}),this.#s=n}as(t){return ht.#i[t](this)}asLegacyColor(){return this.as("rgba")}equal(t){const e=t.as("lab");return ot(e.l,this.l,1)&&ot(e.a,this.a)&&ot(e.b,this.b)&&ot(e.alpha,this.alpha)}format(){return"lab"}setAlpha(t){return new ht(this.l,this.a,this.b,t,void 0)}asString(t){return t?this.as(t).asString():this.#l(this.l,this.a,this.b)}#l(t,r,s){const n=null===this.alpha||ot(this.alpha,1)?"":` / ${e.StringUtilities.stringifyWithPrecision(this.alpha)}`;return`lab(${e.StringUtilities.stringifyWithPrecision(t,0)} ${e.StringUtilities.stringifyWithPrecision(r)} ${e.StringUtilities.stringifyWithPrecision(s)}${n})`}getAuthoredText(){return this.#s??null}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(...this.#n)}isGamutClipped(){return!1}static fromSpec(t,e){const r=Z(t[0],[0,100])??K(t[0]);if(null===r)return null;const s=Z(t[1],[0,125])??K(t[1]);if(null===s)return null;const n=Z(t[2],[0,125])??K(t[2]);if(null===n)return null;const i=J(t[3]);return new ht(r,s,n,i,e)}}class ct{#n;l;c;h;alpha;#s;static#i={nickname:t=>new ft(t.#a(!1),"nickname"),hex:t=>new ft(t.#a(!1),"hex"),shorthex:t=>new ft(t.#a(!1),"shorthex"),hexa:t=>new ft(t.#a(!0),"hexa"),shorthexa:t=>new ft(t.#a(!0),"shorthexa"),rgb:t=>new ft(t.#a(!1),"rgb"),rgba:t=>new ft(t.#a(!0),"rgba"),hsl:t=>new pt(...k(t.#a(!1)),t.alpha),hsla:t=>new pt(...k(t.#a(!1)),t.alpha),hwb:t=>new mt(...B(t.#a(!1)),t.alpha),hwba:t=>new mt(...B(t.#a(!1)),t.alpha),lch:t=>t,oklch:t=>new gt(...A.xyzd50ToOklch(...t.#o()),t.alpha),lab:t=>new ht(...A.lchToLab(t.l,t.c,t.h),t.alpha),oklab:t=>new ut(...A.xyzd65ToOklab(...A.xyzd50ToD65(...t.#o())),t.alpha),srgb:t=>new dt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new dt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new dt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new dt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new dt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new dt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new dt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new dt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new dt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#o(){return A.labToXyzd50(...A.lchToLab(this.l,this.c,this.h))}#a(t=!0){const e=A.xyzd50ToSrgb(...this.#o());return t?[...e,this.alpha??void 0]:e}constructor(t,e,r,s,n){this.#n=[t,e,r],this.l=Y(t,{min:0,max:100}),e=ot(this.l,0,1)||ot(this.l,100,1)?0:e,this.c=Y(e,{min:0}),r=ot(e,0)?0:r,this.h=j(r),this.alpha=Y(s,{min:0,max:1}),this.#s=n}asLegacyColor(){return this.as("rgba")}as(t){return ct.#i[t](this)}equal(t){const e=t.as("lch");return ot(e.l,this.l,1)&&ot(e.c,this.c)&&ot(e.h,this.h)&&ot(e.alpha,this.alpha)}format(){return"lch"}setAlpha(t){return new ct(this.l,this.c,this.h,t)}asString(t){return t?this.as(t).asString():this.#l(this.l,this.c,this.h)}#l(t,r,s){const n=null===this.alpha||ot(this.alpha,1)?"":` / ${e.StringUtilities.stringifyWithPrecision(this.alpha)}`;return`lch(${e.StringUtilities.stringifyWithPrecision(t,0)} ${e.StringUtilities.stringifyWithPrecision(r)} ${e.StringUtilities.stringifyWithPrecision(s)}${n})`}getAuthoredText(){return this.#s??null}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(...this.#n)}isGamutClipped(){return!1}isHuePowerless(){return ot(this.c,0)}static fromSpec(t,e){const r=Z(t[0],[0,100])??K(t[0]);if(null===r)return null;const s=Z(t[1],[0,150])??K(t[1]);if(null===s)return null;const n=$(t[2]);if(null===n)return null;const i=J(t[3]);return new ct(r,s,n,i,e)}}class ut{#n;l;a;b;alpha;#s;static#i={nickname:t=>new ft(t.#a(!1),"nickname"),hex:t=>new ft(t.#a(!1),"hex"),shorthex:t=>new ft(t.#a(!1),"shorthex"),hexa:t=>new ft(t.#a(!0),"hexa"),shorthexa:t=>new ft(t.#a(!0),"shorthexa"),rgb:t=>new ft(t.#a(!1),"rgb"),rgba:t=>new ft(t.#a(!0),"rgba"),hsl:t=>new pt(...k(t.#a(!1)),t.alpha),hsla:t=>new pt(...k(t.#a(!1)),t.alpha),hwb:t=>new mt(...B(t.#a(!1)),t.alpha),hwba:t=>new mt(...B(t.#a(!1)),t.alpha),lch:t=>new ct(...A.labToLch(...A.xyzd50ToLab(...t.#o())),t.alpha),oklch:t=>new gt(...A.xyzd50ToOklch(...t.#o()),t.alpha),lab:t=>new ht(...A.xyzd50ToLab(...t.#o()),t.alpha),oklab:t=>t,srgb:t=>new dt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new dt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new dt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new dt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new dt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new dt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new dt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new dt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new dt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#o(){return A.xyzd65ToD50(...A.oklabToXyzd65(this.l,this.a,this.b))}#a(t=!0){const e=A.xyzd50ToSrgb(...this.#o());return t?[...e,this.alpha??void 0]:e}constructor(t,e,r,s,n){this.#n=[t,e,r],this.l=Y(t,{min:0,max:1}),(ot(this.l,0)||ot(this.l,1))&&(e=r=0),this.a=e,this.b=r,this.alpha=Y(s,{min:0,max:1}),this.#s=n}asLegacyColor(){return this.as("rgba")}as(t){return ut.#i[t](this)}equal(t){const e=t.as("oklab");return ot(e.l,this.l)&&ot(e.a,this.a)&&ot(e.b,this.b)&&ot(e.alpha,this.alpha)}format(){return"oklab"}setAlpha(t){return new ut(this.l,this.a,this.b,t)}asString(t){return t?this.as(t).asString():this.#l(this.l,this.a,this.b)}#l(t,r,s){const n=null===this.alpha||ot(this.alpha,1)?"":` / ${e.StringUtilities.stringifyWithPrecision(this.alpha)}`;return`oklab(${e.StringUtilities.stringifyWithPrecision(t)} ${e.StringUtilities.stringifyWithPrecision(r)} ${e.StringUtilities.stringifyWithPrecision(s)}${n})`}getAuthoredText(){return this.#s??null}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(...this.#n)}isGamutClipped(){return!1}static fromSpec(t,e){const r=Z(t[0],[0,1])??K(t[0]);if(null===r)return null;const s=Z(t[1],[0,.4])??K(t[1]);if(null===s)return null;const n=Z(t[2],[0,.4])??K(t[2]);if(null===n)return null;const i=J(t[3]);return new ut(r,s,n,i,e)}}class gt{#n;l;c;h;alpha;#s;static#i={nickname:t=>new ft(t.#a(!1),"nickname"),hex:t=>new ft(t.#a(!1),"hex"),shorthex:t=>new ft(t.#a(!1),"shorthex"),hexa:t=>new ft(t.#a(!0),"hexa"),shorthexa:t=>new ft(t.#a(!0),"shorthexa"),rgb:t=>new ft(t.#a(!1),"rgb"),rgba:t=>new ft(t.#a(!0),"rgba"),hsl:t=>new pt(...k(t.#a(!1)),t.alpha),hsla:t=>new pt(...k(t.#a(!1)),t.alpha),hwb:t=>new mt(...B(t.#a(!1)),t.alpha),hwba:t=>new mt(...B(t.#a(!1)),t.alpha),lch:t=>new ct(...A.labToLch(...A.xyzd50ToLab(...t.#o())),t.alpha),oklch:t=>t,lab:t=>new ht(...A.xyzd50ToLab(...t.#o()),t.alpha),oklab:t=>new ut(...A.xyzd65ToOklab(...A.xyzd50ToD65(...t.#o())),t.alpha),srgb:t=>new dt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new dt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new dt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new dt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new dt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new dt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new dt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new dt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new dt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#o(){return A.oklchToXyzd50(this.l,this.c,this.h)}#a(t=!0){const e=A.xyzd50ToSrgb(...this.#o());return t?[...e,this.alpha??void 0]:e}constructor(t,e,r,s,n){this.#n=[t,e,r],this.l=Y(t,{min:0,max:1}),e=ot(this.l,0)||ot(this.l,1)?0:e,this.c=Y(e,{min:0}),r=ot(e,0)?0:r,this.h=j(r),this.alpha=Y(s,{min:0,max:1}),this.#s=n}asLegacyColor(){return this.as("rgba")}as(t){return gt.#i[t](this)}equal(t){const e=t.as("oklch");return ot(e.l,this.l)&&ot(e.c,this.c)&&ot(e.h,this.h)&&ot(e.alpha,this.alpha)}format(){return"oklch"}setAlpha(t){return new gt(this.l,this.c,this.h,t)}asString(t){return t?this.as(t).asString():this.#l(this.l,this.c,this.h)}#l(t,r,s){const n=null===this.alpha||ot(this.alpha,1)?"":` / ${e.StringUtilities.stringifyWithPrecision(this.alpha)}`;return`oklch(${e.StringUtilities.stringifyWithPrecision(t)} ${e.StringUtilities.stringifyWithPrecision(r)} ${e.StringUtilities.stringifyWithPrecision(s)}${n})`}getAuthoredText(){return this.#s??null}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(...this.#n)}isGamutClipped(){return!1}static fromSpec(t,e){const r=Z(t[0],[0,1])??K(t[0]);if(null===r)return null;const s=Z(t[1],[0,.4])??K(t[1]);if(null===s)return null;const n=$(t[2]);if(null===n)return null;const i=J(t[3]);return new gt(r,s,n,i,e)}}class dt{#n;p0;p1;p2;alpha;colorSpace;#s;static#i={nickname:t=>new ft(t.#a(!1),"nickname"),hex:t=>new ft(t.#a(!1),"hex"),shorthex:t=>new ft(t.#a(!1),"shorthex"),hexa:t=>new ft(t.#a(!0),"hexa"),shorthexa:t=>new ft(t.#a(!0),"shorthexa"),rgb:t=>new ft(t.#a(!1),"rgb"),rgba:t=>new ft(t.#a(!0),"rgba"),hsl:t=>new pt(...k(t.#a(!1)),t.alpha),hsla:t=>new pt(...k(t.#a(!1)),t.alpha),hwb:t=>new mt(...B(t.#a(!1)),t.alpha),hwba:t=>new mt(...B(t.#a(!1)),t.alpha),lch:t=>new ct(...A.labToLch(...A.xyzd50ToLab(...t.#o())),t.alpha),oklch:t=>new gt(...A.xyzd50ToOklch(...t.#o()),t.alpha),lab:t=>new ht(...A.xyzd50ToLab(...t.#o()),t.alpha),oklab:t=>new ut(...A.xyzd65ToOklab(...A.xyzd50ToD65(...t.#o())),t.alpha),srgb:t=>new dt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new dt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new dt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new dt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new dt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new dt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new dt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new dt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new dt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#o(){const[t,e,r]=this.#n;switch(this.colorSpace){case"srgb":return A.srgbToXyzd50(t,e,r);case"srgb-linear":return A.srgbLinearToXyzd50(t,e,r);case"display-p3":return A.displayP3ToXyzd50(t,e,r);case"a98-rgb":return A.adobeRGBToXyzd50(t,e,r);case"prophoto-rgb":return A.proPhotoToXyzd50(t,e,r);case"rec2020":return A.rec2020ToXyzd50(t,e,r);case"xyz-d50":return[t,e,r];case"xyz":case"xyz-d65":return A.xyzd65ToD50(t,e,r)}throw new Error("Invalid color space")}#a(t=!0){const[e,r,s]=this.#n,n="srgb"===this.colorSpace?[e,r,s]:[...A.xyzd50ToSrgb(...this.#o())];return t?[...n,this.alpha??void 0]:n}constructor(t,e,r,s,n,i){this.#n=[e,r,s],this.colorSpace=t,this.#s=i,"xyz-d50"!==this.colorSpace&&"xyz-d65"!==this.colorSpace&&"xyz"!==this.colorSpace&&(e=Y(e,{min:0,max:1}),r=Y(r,{min:0,max:1}),s=Y(s,{min:0,max:1})),this.p0=e,this.p1=r,this.p2=s,this.alpha=Y(n,{min:0,max:1})}asLegacyColor(){return this.as("rgba")}as(t){return this.colorSpace===t?this:dt.#i[t](this)}equal(t){const e=t.as(this.colorSpace);return ot(this.p0,e.p0)&&ot(this.p1,e.p1)&&ot(this.p2,e.p2)&&ot(this.alpha,e.alpha)}format(){return this.colorSpace}setAlpha(t){return new dt(this.colorSpace,this.p0,this.p1,this.p2,t)}asString(t){return t?this.as(t).asString():this.#l(this.p0,this.p1,this.p2)}#l(t,r,s){const n=null===this.alpha||ot(this.alpha,1)?"":` / ${e.StringUtilities.stringifyWithPrecision(this.alpha)}`;return`color(${this.colorSpace} ${e.StringUtilities.stringifyWithPrecision(t)} ${e.StringUtilities.stringifyWithPrecision(r)} ${e.StringUtilities.stringifyWithPrecision(s)}${n})`}getAuthoredText(){return this.#s??null}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(...this.#n)}isGamutClipped(){return"xyz-d50"!==this.colorSpace&&"xyz-d65"!==this.colorSpace&&"xyz"!==this.colorSpace&&!ot(this.#n,[this.p0,this.p1,this.p2])}static fromSpec(t,e){const[r,s]=e.split("/",2),n=r.trim().split(/\s+/),[i,...a]=n,o=H(i);if(!o)return null;if(0===a.length&&void 0===s)return new dt(o,0,0,0,null,t);if(0===a.length&&void 0!==s&&s.trim().split(/\s+/).length>1)return null;if(a.length>3)return null;const l=a.map((t=>"none"===t?"0":t)).map((t=>Q(t,[0,1])));if(l.includes(null))return null;const h=s?Q(s,[0,1])??1:1,c=[l[0]??0,l[1]??0,l[2]??0,h];return new dt(o,...c,t)}}class pt{h;s;l;alpha;#n;#s;static#i={nickname:t=>new ft(t.#a(!1),"nickname"),hex:t=>new ft(t.#a(!1),"hex"),shorthex:t=>new ft(t.#a(!1),"shorthex"),hexa:t=>new ft(t.#a(!0),"hexa"),shorthexa:t=>new ft(t.#a(!0),"shorthexa"),rgb:t=>new ft(t.#a(!1),"rgb"),rgba:t=>new ft(t.#a(!0),"rgba"),hsl:t=>t,hsla:t=>t,hwb:t=>new mt(...B(t.#a(!1)),t.alpha),hwba:t=>new mt(...B(t.#a(!1)),t.alpha),lch:t=>new ct(...A.labToLch(...A.xyzd50ToLab(...t.#o())),t.alpha),oklch:t=>new gt(...A.xyzd50ToOklch(...t.#o()),t.alpha),lab:t=>new ht(...A.xyzd50ToLab(...t.#o()),t.alpha),oklab:t=>new ut(...A.xyzd65ToOklab(...A.xyzd50ToD65(...t.#o())),t.alpha),srgb:t=>new dt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new dt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new dt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new dt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new dt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new dt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new dt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new dt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new dt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#a(t=!0){const e=[0,0,0,0];return st([this.h,this.s,this.l,0],e),t?[e[0],e[1],e[2],this.alpha??void 0]:[e[0],e[1],e[2]]}#o(){const t=this.#a(!1);return A.srgbToXyzd50(t[0],t[1],t[2])}constructor(t,e,r,s,n){this.#n=[t,e,r],this.l=Y(r,{min:0,max:1}),e=ot(this.l,0)||ot(this.l,1)?0:e,this.s=Y(e,{min:0,max:1}),t=ot(this.s,0)?0:t,this.h=j(360*t)/360,this.alpha=Y(s??null,{min:0,max:1}),this.#s=n}equal(t){const e=t.as("hsl");return ot(this.h,e.h)&&ot(this.s,e.s)&&ot(this.l,e.l)&&ot(this.alpha,e.alpha)}asString(t){return t?this.as(t).asString():this.#l(this.h,this.s,this.l)}#l(t,r,s){const n=e.StringUtilities.sprintf("hsl(%sdeg %s% %s%",e.StringUtilities.stringifyWithPrecision(360*t),e.StringUtilities.stringifyWithPrecision(100*r),e.StringUtilities.stringifyWithPrecision(100*s));return null!==this.alpha&&1!==this.alpha?n+e.StringUtilities.sprintf(" / %s%)",e.StringUtilities.stringifyWithPrecision(100*this.alpha)):n+")"}setAlpha(t){return new pt(this.h,this.s,this.l,t)}format(){return null===this.alpha||1===this.alpha?"hsl":"hsla"}as(t){return t===this.format()?this:pt.#i[t](this)}asLegacyColor(){return this.as("rgba")}getAuthoredText(){return this.#s??null}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(...this.#n)}isGamutClipped(){return!lt(this.#n[1],1)||!lt(0,this.#n[1])}static fromSpec(t,e){const r=et(t[0]);if(null===r)return null;const s=rt(t[1]);if(null===s)return null;const n=rt(t[2]);if(null===n)return null;const i=J(t[3]);return new pt(r,s,n,i,e)}hsva(){const t=this.s*(this.l<.5?this.l:1-this.l);return[this.h,0!==t?2*t/(this.l+t):0,this.l+t,this.alpha??1]}canonicalHSLA(){return[Math.round(360*this.h),Math.round(100*this.s),Math.round(100*this.l),this.alpha??1]}}class mt{h;w;b;alpha;#n;#s;static#i={nickname:t=>new ft(t.#a(!1),"nickname"),hex:t=>new ft(t.#a(!1),"hex"),shorthex:t=>new ft(t.#a(!1),"shorthex"),hexa:t=>new ft(t.#a(!0),"hexa"),shorthexa:t=>new ft(t.#a(!0),"shorthexa"),rgb:t=>new ft(t.#a(!1),"rgb"),rgba:t=>new ft(t.#a(!0),"rgba"),hsl:t=>new pt(...k(t.#a(!1)),t.alpha),hsla:t=>new pt(...k(t.#a(!1)),t.alpha),hwb:t=>t,hwba:t=>t,lch:t=>new ct(...A.labToLch(...A.xyzd50ToLab(...t.#o())),t.alpha),oklch:t=>new gt(...A.xyzd50ToOklch(...t.#o()),t.alpha),lab:t=>new ht(...A.xyzd50ToLab(...t.#o()),t.alpha),oklab:t=>new ut(...A.xyzd65ToOklab(...A.xyzd50ToD65(...t.#o())),t.alpha),srgb:t=>new dt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new dt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new dt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new dt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new dt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new dt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new dt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new dt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new dt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#a(t=!0){const e=[0,0,0,0];return function(t,e){const r=t[0],s=t[1],n=t[2];if(s+n>=1)e[0]=e[1]=e[2]=s/(s+n),e[3]=t[3];else{st([r,1,.5,t[3]],e);for(let t=0;t<3;++t)e[t]+=s-(s+n)*e[t]}}([this.h,this.w,this.b,0],e),t?[e[0],e[1],e[2],this.alpha??void 0]:[e[0],e[1],e[2]]}#o(){const t=this.#a(!1);return A.srgbToXyzd50(t[0],t[1],t[2])}constructor(t,e,r,s,n){if(this.#n=[t,e,r],this.w=Y(e,{min:0,max:1}),this.b=Y(r,{min:0,max:1}),t=lt(1,this.w+this.b)?0:t,this.h=j(360*t)/360,this.alpha=Y(s,{min:0,max:1}),lt(1,this.w+this.b)){const t=this.w/this.b;this.b=1/(1+t),this.w=1-this.b}this.#s=n}equal(t){const e=t.as("hwb");return ot(this.h,e.h)&&ot(this.w,e.w)&&ot(this.b,e.b)&&ot(this.alpha,e.alpha)}asString(t){return t?this.as(t).asString():this.#l(this.h,this.w,this.b)}#l(t,r,s){const n=e.StringUtilities.sprintf("hwb(%sdeg %s% %s%",e.StringUtilities.stringifyWithPrecision(360*t),e.StringUtilities.stringifyWithPrecision(100*r),e.StringUtilities.stringifyWithPrecision(100*s));return null!==this.alpha&&1!==this.alpha?n+e.StringUtilities.sprintf(" / %s%)",e.StringUtilities.stringifyWithPrecision(100*this.alpha)):n+")"}setAlpha(t){return new mt(this.h,this.w,this.b,t,this.#s)}format(){return null===this.alpha||ot(this.alpha,1)?"hwb":"hwba"}as(t){return t===this.format()?this:mt.#i[t](this)}asLegacyColor(){return this.as("rgba")}getAuthoredText(){return this.#s??null}canonicalHWBA(){return[Math.round(360*this.h),Math.round(100*this.w),Math.round(100*this.b),this.alpha??1]}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(...this.#n)}isGamutClipped(){return!(lt(this.#n[1],1)&&lt(0,this.#n[1])&&lt(this.#n[2],1)&&lt(0,this.#n[2]))}static fromSpec(t,e){const r=et(t[0]);if(null===r)return null;const s=rt(t[1]);if(null===s)return null;const n=rt(t[2]);if(null===n)return null;const i=J(t[3]);return new mt(r,s,n,i,e)}}function yt(t){return Math.round(255*t)}class ft{#n;#h;#s;#c;static#i={nickname:t=>new ft(t.#h,"nickname"),hex:t=>new ft(t.#h,"hex"),shorthex:t=>new ft(t.#h,"shorthex"),hexa:t=>new ft(t.#h,"hexa"),shorthexa:t=>new ft(t.#h,"shorthexa"),rgb:t=>new ft(t.#h,"rgb"),rgba:t=>new ft(t.#h,"rgba"),hsl:t=>new pt(...k([t.#h[0],t.#h[1],t.#h[2]]),t.alpha),hsla:t=>new pt(...k([t.#h[0],t.#h[1],t.#h[2]]),t.alpha),hwb:t=>new mt(...B([t.#h[0],t.#h[1],t.#h[2]]),t.alpha),hwba:t=>new mt(...B([t.#h[0],t.#h[1],t.#h[2]]),t.alpha),lch:t=>new ct(...A.labToLch(...A.xyzd50ToLab(...t.#o())),t.alpha),oklch:t=>new gt(...A.xyzd50ToOklch(...t.#o()),t.alpha),lab:t=>new ht(...A.xyzd50ToLab(...t.#o()),t.alpha),oklab:t=>new ut(...A.xyzd65ToOklab(...A.xyzd50ToD65(...t.#o())),t.alpha),srgb:t=>new dt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new dt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new dt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new dt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new dt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new dt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new dt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new dt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new dt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#o(){const[t,e,r]=this.#h;return A.srgbToXyzd50(t,e,r)}get alpha(){switch(this.format()){case"hexa":case"shorthexa":case"rgba":return this.#h[3];default:return null}}asLegacyColor(){return this}constructor(t,e,r){this.#s=r||null,this.#c=e,this.#n=[t[0],t[1],t[2]],this.#h=[Y(t[0],{min:0,max:1}),Y(t[1],{min:0,max:1}),Y(t[2],{min:0,max:1}),Y(t[3]??1,{min:0,max:1})]}static fromHex(t,e){let r;3===(t=t.toLowerCase()).length?(r="shorthex",t=t.charAt(0)+t.charAt(0)+t.charAt(1)+t.charAt(1)+t.charAt(2)+t.charAt(2)):4===t.length?(r="shorthexa",t=t.charAt(0)+t.charAt(0)+t.charAt(1)+t.charAt(1)+t.charAt(2)+t.charAt(2)+t.charAt(3)+t.charAt(3)):r=6===t.length?"hex":"hexa";const s=parseInt(t.substring(0,2),16),n=parseInt(t.substring(2,4),16),i=parseInt(t.substring(4,6),16);let a=1;return 8===t.length&&(a=parseInt(t.substring(6,8),16)/255),new ft([s/255,n/255,i/255,a],r,e)}static fromName(t,e){const r=t.toLowerCase(),s=bt.get(r);if(void 0!==s){const t=ft.fromRGBA(s,e);return t.#c="nickname",t}return null}static fromRGBAFunction(t,r,s,n,i){const a=[tt(t),tt(r),tt(s),n?(o=n,Q(o)):1];var o;return e.ArrayUtilities.arrayDoesNotContainNullOrUndefined(a)?new ft(a,n?"rgba":"rgb",i):null}static fromRGBA(t,e){return new ft([t[0]/255,t[1]/255,t[2]/255,t[3]],"rgba",e)}static fromHSVA(t){const e=[0,0,0,0];return nt(t,e),new ft(e,"rgba")}as(t){return t===this.format()?this:ft.#i[t](this)}format(){return this.#c}hasAlpha(){return 1!==this.#h[3]}detectHEXFormat(){let t=!0;for(let e=0;e<4;++e){if(Math.round(255*this.#h[e])%17){t=!1;break}}const e=this.hasAlpha();return t?e?"shorthexa":"shorthex":e?"hexa":"hex"}asString(t){return t?this.as(t).asString():this.#l(t,this.#h[0],this.#h[1],this.#h[2])}#l(t,r,s,n){function i(t){const e=Math.round(255*t).toString(16);return 1===e.length?"0"+e:e}function a(t){return(Math.round(255*t)/17).toString(16)}switch(t||(t=this.#c),t){case"rgb":case"rgba":{const t=e.StringUtilities.sprintf("rgb(%d %d %d",yt(r),yt(s),yt(n));return this.hasAlpha()?t+e.StringUtilities.sprintf(" / %d%)",Math.round(100*this.#h[3])):t+")"}case"hexa":return e.StringUtilities.sprintf("#%s%s%s%s",i(r),i(s),i(n),i(this.#h[3])).toLowerCase();case"hex":return this.hasAlpha()?null:e.StringUtilities.sprintf("#%s%s%s",i(r),i(s),i(n)).toLowerCase();case"shorthexa":{const t=this.detectHEXFormat();return"shorthexa"!==t&&"shorthex"!==t?null:e.StringUtilities.sprintf("#%s%s%s%s",a(r),a(s),a(n),a(this.#h[3])).toLowerCase()}case"shorthex":return this.hasAlpha()||"shorthex"!==this.detectHEXFormat()?null:e.StringUtilities.sprintf("#%s%s%s",a(r),a(s),a(n)).toLowerCase();case"nickname":return this.nickname()}return null}getAuthoredText(){return this.#s??null}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(t,...this.#n)}isGamutClipped(){return!ot(this.#n.map(yt),[this.#h[0],this.#h[1],this.#h[2]].map(yt),1)}rgba(){return[...this.#h]}canonicalRGBA(){const t=new Array(4);for(let e=0;e<3;++e)t[e]=Math.round(255*this.#h[e]);return t[3]=this.#h[3],t}nickname(){return St.get(String(this.canonicalRGBA()))||null}toProtocolRGBA(){const t=this.canonicalRGBA(),e={r:t[0],g:t[1],b:t[2],a:void 0};return 1!==t[3]&&(e.a=t[3]),e}invert(){const t=[0,0,0,0];return t[0]=1-this.#h[0],t[1]=1-this.#h[1],t[2]=1-this.#h[2],t[3]=this.#h[3],new ft(t,"rgba")}setAlpha(t){const e=[...this.#h];return e[3]=t,new ft(e,"rgba")}blendWith(t){const e=P(t.#h,this.#h);return new ft(e,"rgba")}blendWithAlpha(t){const e=[...this.#h];return e[3]*=t,new ft(e,"rgba")}setFormat(t){this.#c=t}equal(t){const e=t.as(this.#c);return ot(yt(this.#h[0]),yt(e.#h[0]),1)&&ot(yt(this.#h[1]),yt(e.#h[1]),1)&&ot(yt(this.#h[2]),yt(e.#h[2]),1)&&ot(this.#h[3],e.#h[3])}}const wt=[["aliceblue",[240,248,255]],["antiquewhite",[250,235,215]],["aqua",[0,255,255]],["aquamarine",[127,255,212]],["azure",[240,255,255]],["beige",[245,245,220]],["bisque",[255,228,196]],["black",[0,0,0]],["blanchedalmond",[255,235,205]],["blue",[0,0,255]],["blueviolet",[138,43,226]],["brown",[165,42,42]],["burlywood",[222,184,135]],["cadetblue",[95,158,160]],["chartreuse",[127,255,0]],["chocolate",[210,105,30]],["coral",[255,127,80]],["cornflowerblue",[100,149,237]],["cornsilk",[255,248,220]],["crimson",[237,20,61]],["cyan",[0,255,255]],["darkblue",[0,0,139]],["darkcyan",[0,139,139]],["darkgoldenrod",[184,134,11]],["darkgray",[169,169,169]],["darkgrey",[169,169,169]],["darkgreen",[0,100,0]],["darkkhaki",[189,183,107]],["darkmagenta",[139,0,139]],["darkolivegreen",[85,107,47]],["darkorange",[255,140,0]],["darkorchid",[153,50,204]],["darkred",[139,0,0]],["darksalmon",[233,150,122]],["darkseagreen",[143,188,143]],["darkslateblue",[72,61,139]],["darkslategray",[47,79,79]],["darkslategrey",[47,79,79]],["darkturquoise",[0,206,209]],["darkviolet",[148,0,211]],["deeppink",[255,20,147]],["deepskyblue",[0,191,255]],["dimgray",[105,105,105]],["dimgrey",[105,105,105]],["dodgerblue",[30,144,255]],["firebrick",[178,34,34]],["floralwhite",[255,250,240]],["forestgreen",[34,139,34]],["fuchsia",[255,0,255]],["gainsboro",[220,220,220]],["ghostwhite",[248,248,255]],["gold",[255,215,0]],["goldenrod",[218,165,32]],["gray",[128,128,128]],["grey",[128,128,128]],["green",[0,128,0]],["greenyellow",[173,255,47]],["honeydew",[240,255,240]],["hotpink",[255,105,180]],["indianred",[205,92,92]],["indigo",[75,0,130]],["ivory",[255,255,240]],["khaki",[240,230,140]],["lavender",[230,230,250]],["lavenderblush",[255,240,245]],["lawngreen",[124,252,0]],["lemonchiffon",[255,250,205]],["lightblue",[173,216,230]],["lightcoral",[240,128,128]],["lightcyan",[224,255,255]],["lightgoldenrodyellow",[250,250,210]],["lightgreen",[144,238,144]],["lightgray",[211,211,211]],["lightgrey",[211,211,211]],["lightpink",[255,182,193]],["lightsalmon",[255,160,122]],["lightseagreen",[32,178,170]],["lightskyblue",[135,206,250]],["lightslategray",[119,136,153]],["lightslategrey",[119,136,153]],["lightsteelblue",[176,196,222]],["lightyellow",[255,255,224]],["lime",[0,255,0]],["limegreen",[50,205,50]],["linen",[250,240,230]],["magenta",[255,0,255]],["maroon",[128,0,0]],["mediumaquamarine",[102,205,170]],["mediumblue",[0,0,205]],["mediumorchid",[186,85,211]],["mediumpurple",[147,112,219]],["mediumseagreen",[60,179,113]],["mediumslateblue",[123,104,238]],["mediumspringgreen",[0,250,154]],["mediumturquoise",[72,209,204]],["mediumvioletred",[199,21,133]],["midnightblue",[25,25,112]],["mintcream",[245,255,250]],["mistyrose",[255,228,225]],["moccasin",[255,228,181]],["navajowhite",[255,222,173]],["navy",[0,0,128]],["oldlace",[253,245,230]],["olive",[128,128,0]],["olivedrab",[107,142,35]],["orange",[255,165,0]],["orangered",[255,69,0]],["orchid",[218,112,214]],["palegoldenrod",[238,232,170]],["palegreen",[152,251,152]],["paleturquoise",[175,238,238]],["palevioletred",[219,112,147]],["papayawhip",[255,239,213]],["peachpuff",[255,218,185]],["peru",[205,133,63]],["pink",[255,192,203]],["plum",[221,160,221]],["powderblue",[176,224,230]],["purple",[128,0,128]],["rebeccapurple",[102,51,153]],["red",[255,0,0]],["rosybrown",[188,143,143]],["royalblue",[65,105,225]],["saddlebrown",[139,69,19]],["salmon",[250,128,114]],["sandybrown",[244,164,96]],["seagreen",[46,139,87]],["seashell",[255,245,238]],["sienna",[160,82,45]],["silver",[192,192,192]],["skyblue",[135,206,235]],["slateblue",[106,90,205]],["slategray",[112,128,144]],["slategrey",[112,128,144]],["snow",[255,250,250]],["springgreen",[0,255,127]],["steelblue",[70,130,180]],["tan",[210,180,140]],["teal",[0,128,128]],["thistle",[216,191,216]],["tomato",[255,99,71]],["turquoise",[64,224,208]],["violet",[238,130,238]],["wheat",[245,222,179]],["white",[255,255,255]],["whitesmoke",[245,245,245]],["yellow",[255,255,0]],["yellowgreen",[154,205,50]],["transparent",[0,0,0,0]]],bt=new Map(wt),St=new Map(wt.map((([t,[e,r,s,n=1]])=>[String([e,r,s,n]),t]))),xt=[127,32,210],Tt={Content:ft.fromRGBA([111,168,220,.66]),ContentLight:ft.fromRGBA([111,168,220,.5]),ContentOutline:ft.fromRGBA([9,83,148]),Padding:ft.fromRGBA([147,196,125,.55]),PaddingLight:ft.fromRGBA([147,196,125,.4]),Border:ft.fromRGBA([255,229,153,.66]),BorderLight:ft.fromRGBA([255,229,153,.5]),Margin:ft.fromRGBA([246,178,107,.66]),MarginLight:ft.fromRGBA([246,178,107,.5]),EventTarget:ft.fromRGBA([255,196,196,.66]),Shape:ft.fromRGBA([96,82,177,.8]),ShapeMargin:ft.fromRGBA([96,82,127,.6]),CssGrid:ft.fromRGBA([75,0,130,1]),LayoutLine:ft.fromRGBA([...xt,1]),GridBorder:ft.fromRGBA([...xt,1]),GapBackground:ft.fromRGBA([...xt,.3]),GapHatch:ft.fromRGBA([...xt,.8]),GridAreaBorder:ft.fromRGBA([26,115,232,1])},Rt={ParentOutline:ft.fromRGBA([224,90,183,1]),ChildOutline:ft.fromRGBA([0,120,212,1])},vt={Resizer:ft.fromRGBA([222,225,230,1]),ResizerHandle:ft.fromRGBA([166,166,166,1]),Mask:ft.fromRGBA([248,249,249,1])};var zt=Object.freeze({__proto__:null,getFormat:function(t){switch(t){case"nickname":return"nickname";case"hex":return"hex";case"shorthex":return"shorthex";case"hexa":return"hexa";case"shorthexa":return"shorthexa";case"rgb":return"rgb";case"rgba":return"rgba";case"hsl":return"hsl";case"hsla":return"hsla";case"hwb":return"hwb";case"hwba":return"hwba";case"lch":return"lch";case"oklch":return"oklch";case"lab":return"lab";case"oklab":return"oklab"}return H(t)},parse:function(t){let e=t.toLowerCase().replace(/\s+/g,"").match(/^(?:#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})|(\w+))$/i);if(e)return e[1]?ft.fromHex(e[1],t):e[2]?ft.fromName(e[2],t):null;if(e=t.toLowerCase().match(/^\s*(?:(rgba?)|(hsla?)|(hwba?)|(lch)|(oklch)|(lab)|(oklab)|(color))\((.*)\)\s*$/),e){const r=Boolean(e[1]),s=Boolean(e[2]),n=Boolean(e[3]),i=Boolean(e[4]),a=Boolean(e[5]),o=Boolean(e[6]),l=Boolean(e[7]),h=Boolean(e[8]),c=e[9];if(h)return dt.fromSpec(t,c);const u=function(t,{allowCommas:e,convertNoneToZero:r}){const s=t.trim();let n=[];e&&(n=s.split(/\s*,\s*/));if(!e||1===n.length)if(n=s.split(/\s+/),"/"===n[3]){if(n.splice(3,1),4!==n.length)return null}else if(n.length>2&&-1!==n[2].indexOf("/")||n.length>3&&-1!==n[3].indexOf("/")){const t=n.slice(2,4).join("");n=n.slice(0,2).concat(t.split(/\//)).concat(n.slice(4))}else if(n.length>=4)return null;if(3!==n.length&&4!==n.length||n.indexOf("")>-1)return null;if(r)return n.map((t=>"none"===t?"0":t));return n}(c,{allowCommas:r||s,convertNoneToZero:!(r||s||n)});if(!u)return null;const g=[u[0],u[1],u[2],u[3]];if(r)return ft.fromRGBAFunction(u[0],u[1],u[2],u[3],t);if(s)return pt.fromSpec(g,t);if(n)return mt.fromSpec(g,t);if(i)return ct.fromSpec(g,t);if(a)return gt.fromSpec(g,t);if(o)return ht.fromSpec(g,t);if(l)return ut.fromSpec(g,t)}return null},hsl2rgb:st,hsva2rgba:nt,rgb2hsv:function(t){const e=k(t),r=e[0];let s=e[1];const n=e[2];return s*=n<.5?n:1-n,[r,0!==s?2*s/(n+s):0,n+s]},desiredLuminance:it,approachColorValue:at,findFgColorForContrast:function(t,e,r){const s=t.as("hsl").hsva(),n=e.rgba(),i=t=>C(P(ft.fromHSVA(t).rgba(),n)),a=C(e.rgba()),o=it(a,r,i(s)>a);return at(s,0,2,o,i)?ft.fromHSVA(s):(s[2]=1,at(s,0,1,o,i)?ft.fromHSVA(s):null)},findFgColorForContrastAPCA:function(t,e,r){const s=t.as("hsl").hsva(),n=(e.rgba(),t=>N(ft.fromHSVA(t).rgba())),i=N(e.rgba()),a=M(i,r,n(s)>=i);if(at(s,0,2,a,n)){const t=ft.fromHSVA(s);if(Math.abs(G(e.rgba(),t.rgba()))>=r)return t}if(s[2]=1,at(s,0,1,a,n)){const t=ft.fromHSVA(s);if(Math.abs(G(e.rgba(),t.rgba()))>=r)return t}return null},Lab:ht,LCH:ct,Oklab:ut,Oklch:gt,ColorFunction:dt,HSL:pt,HWB:mt,Legacy:ft,Regex:/((?:rgba?|hsla?|hwba?|lab|lch|oklab|oklch|color)\([^)]+\)|#[0-9a-fA-F]{8}|#[0-9a-fA-F]{6}|#[0-9a-fA-F]{3,4}|\b[a-zA-Z]+\b(?!-))/g,ColorMixRegex:/color-mix\(.*,\s*(?<firstColor>.+)\s*,\s*(?<secondColor>.+)\s*\)/g,Nicknames:bt,PageHighlight:Tt,SourceOrderHighlight:Rt,IsolationModeHighlight:vt,Generator:class{#u;#g;#d;#p;#m;constructor(t,e,r,s){this.#u=t||{min:0,max:360,count:void 0},this.#g=e||67,this.#d=r||80,this.#p=s||1,this.#m=new Map}setColorForID(t,e){this.#m.set(t,e)}colorForID(t){let e=this.#m.get(t);return e||(e=this.generateColorForID(t),this.#m.set(t,e)),e}generateColorForID(t){const r=e.StringUtilities.hashCode(t),s=this.indexToValueInSpace(r,this.#u),n=this.indexToValueInSpace(r>>8,this.#g),i=this.indexToValueInSpace(r>>16,this.#d),a=this.indexToValueInSpace(r>>24,this.#p),o=`hsl(${s}deg ${n}% ${i}%`;return 1!==a?`${o} / ${Math.floor(100*a)}%)`:`${o})`}indexToValueInSpace(t,e){if("number"==typeof e)return e;const r=e.count||e.max-e.min;return t%=r,e.min+Math.floor(t/(r-1)*(e.max-e.min))}}});class At{listeners;addEventListener(t,e,r){this.listeners||(this.listeners=new Map);let s=this.listeners.get(t);return s||(s=new Set,this.listeners.set(t,s)),s.add({thisObject:r,listener:e}),{eventTarget:this,eventType:t,thisObject:r,listener:e}}once(t){return new Promise((e=>{const r=this.addEventListener(t,(s=>{this.removeEventListener(t,r.listener),e(s.data)}))}))}removeEventListener(t,e,r){const s=this.listeners?.get(t);if(s){for(const t of s)t.listener===e&&t.thisObject===r&&(t.disposed=!0,s.delete(t));s.size||this.listeners?.delete(t)}}hasEventListeners(t){return Boolean(this.listeners&&this.listeners.has(t))}dispatchEventToListeners(t,...[e]){const r=this.listeners?.get(t);if(!r)return;const s={data:e,source:this};for(const t of[...r])t.disposed||t.listener.call(t.thisObject,s)}}var It=Object.freeze({__proto__:null,ObjectWrapper:At,eventMixin:function(t){return class extends t{#y=new At;addEventListener(t,e,r){return this.#y.addEventListener(t,e,r)}once(t){return this.#y.once(t)}removeEventListener(t,e,r){this.#y.removeEventListener(t,e,r)}hasEventListeners(t){return this.#y.hasEventListeners(t)}dispatchEventToListeners(t,...e){this.#y.dispatchEventToListeners(t,...e)}}}});const Pt={elementsPanel:"Elements panel",stylesSidebar:"styles sidebar",changesDrawer:"Changes drawer",issuesView:"Issues view",networkPanel:"Network panel",applicationPanel:"Application panel",sourcesPanel:"Sources panel"},Et=r.i18n.registerUIStrings("core/common/Revealer.ts",Pt),kt=r.i18n.getLazilyComputedLocalizedString.bind(void 0,Et);let Lt=async function(t,e){if(!t)return Promise.reject(new Error("Can't reveal "+t));const r=await Promise.all(Ot(t).map((t=>t.loadRevealer())));return r.length?function(r){const s=[];for(let n=0;n<r.length;++n)s.push(r[n].reveal(t,e));return Promise.race(s)}(r):Promise.reject(new Error("Can't reveal "+t))};const Bt=[];function Ot(t){return Bt.filter((function(e){if(!e.contextTypes)return!0;for(const r of e.contextTypes())if(t instanceof r)return!0;return!1}))}const Ct={ELEMENTS_PANEL:kt(Pt.elementsPanel),STYLES_SIDEBAR:kt(Pt.stylesSidebar),CHANGES_DRAWER:kt(Pt.changesDrawer),ISSUES_VIEW:kt(Pt.issuesView),NETWORK_PANEL:kt(Pt.networkPanel),APPLICATION_PANEL:kt(Pt.applicationPanel),SOURCES_PANEL:kt(Pt.sourcesPanel)};var Nt=Object.freeze({__proto__:null,Revealer:class{},get reveal(){return Lt},setRevealForTest:function(t){Lt=t},revealDestination:function(t){const e=t?Ot(t)[0]:Bt[0];return e&&e.destination?.()||null},registerRevealer:function(t){Bt.push(t)},RevealerDestination:Ct});let Gt;class _t extends At{#f;constructor(){super(),this.#f=[]}static instance(t){return Gt&&!t?.forceNew||(Gt=new _t),Gt}static removeInstance(){Gt=void 0}addMessage(t,e,r){const s=new Wt(t,e||Mt.Info,Date.now(),r||!1);this.#f.push(s),this.dispatchEventToListeners(Vt.MessageAdded,s)}log(t){this.addMessage(t,Mt.Info)}warn(t){this.addMessage(t,Mt.Warning)}error(t){this.addMessage(t,Mt.Error,!0)}messages(){return this.#f}show(){this.showPromise()}showPromise(){return Lt(this)}}var Vt,Mt;!function(t){t.MessageAdded="messageAdded"}(Vt||(Vt={})),function(t){t.Info="info",t.Warning="warning",t.Error="error"}(Mt||(Mt={}));class Wt{text;level;timestamp;show;constructor(t,e,r,s){this.text=t,this.level=e,this.timestamp="number"==typeof r?r:Date.now(),this.show=s}}var Xt=Object.freeze({__proto__:null,Console:_t,get Events(){return Vt},get MessageLevel(){return Mt},Message:Wt});var Ft=Object.freeze({__proto__:null,debounce:function(t,e){let r=0;return()=>{clearTimeout(r),r=window.setTimeout((()=>t()),e)}}});var Dt=Object.freeze({__proto__:null,removeEventListeners:function(t){for(const e of t)e.eventTarget.removeEventListener(e.eventType,e.listener,e.thisObject);t.splice(0)},fireEvent:function(t,e={},r=window){const s=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e});r.dispatchEvent(s)}}),Ut=Object.freeze({__proto__:null});const jt=Symbol("uninitialized"),$t=Symbol("error");var Ht=Object.freeze({__proto__:null,lazy:function(t){let e=jt,r=null;return()=>{if(e===$t)throw r;if(e!==jt)return e;try{return e=t(),e}catch(t){throw r=t,e=$t,r}}}});const qt=[];function Yt(t){return qt.filter((function(e){if(!e.contextTypes)return!0;for(const r of e.contextTypes())if(t instanceof r)return!0;return!1}))}var Zt=Object.freeze({__proto__:null,Linkifier:class{static async linkify(t,e){if(!t)throw new Error("Can't linkify "+t);const r=Yt(t)[0];if(!r)throw new Error("No linkifiers registered for object "+t);return(await r.loadLinkifier()).linkify(t,e)}},registerLinkifier:function(t){qt.push(t)},getApplicableRegisteredlinkifiers:Yt});var Kt=Object.freeze({__proto__:null,Mutex:class{#w=!1;#b=[];acquire(){const t={resolved:!1};return this.#w?new Promise((e=>{this.#b.push((()=>e(this.#S.bind(this,t))))})):(this.#w=!0,Promise.resolve(this.#S.bind(this,t)))}#S(t){if(t.resolved)throw new Error("Cannot release more than once.");t.resolved=!0;const e=this.#b.shift();e?e():this.#w=!1}async run(t){const e=await this.acquire();try{return await t()}finally{e()}}}});function Jt(t){if(-1===t.indexOf("..")&&-1===t.indexOf("."))return t;const e=("/"===t[0]?t.substring(1):t).split("/"),r=[];for(const t of e)"."!==t&&(".."===t?r.pop():r.push(t));let s=r.join("/");return"/"===t[0]&&s&&(s="/"+s),"/"===s[s.length-1]||"/"!==t[t.length-1]&&"."!==e[e.length-1]&&".."!==e[e.length-1]||(s+="/"),s}class Qt{isValid;url;scheme;user;host;port;path;queryParams;fragment;folderPathComponents;lastPathComponent;blobInnerScheme;#x;#T;constructor(t){this.isValid=!1,this.url=t,this.scheme="",this.user="",this.host="",this.port="",this.path="",this.queryParams="",this.fragment="",this.folderPathComponents="",this.lastPathComponent="";const e=this.url.startsWith("blob:"),r=(e?t.substring(5):t).match(Qt.urlRegex());if(r)this.isValid=!0,e?(this.blobInnerScheme=r[2].toLowerCase(),this.scheme="blob"):this.scheme=r[2].toLowerCase(),this.user=r[3]??"",this.host=r[4]??"",this.port=r[5]??"",this.path=r[6]??"/",this.queryParams=r[7]??"",this.fragment=r[8]??"";else{if(this.url.startsWith("data:"))return void(this.scheme="data");if(this.url.startsWith("blob:"))return void(this.scheme="blob");if("about:blank"===this.url)return void(this.scheme="about");this.path=this.url}const s=this.path.lastIndexOf("/");-1!==s?(this.folderPathComponents=this.path.substring(0,s),this.lastPathComponent=this.path.substring(s+1)):this.lastPathComponent=this.path}static fromString(t){const e=new Qt(t.toString());return e.isValid?e:null}static preEncodeSpecialCharactersInPath(t){for(const e of["%",";","#","?"," "])t=t.replaceAll(e,encodeURIComponent(e));return t}static rawPathToEncodedPathString(t){const e=Qt.preEncodeSpecialCharactersInPath(t);return t.startsWith("/")?new URL(e,"file:///").pathname:new URL("/"+e,"file:///").pathname.substr(1)}static encodedFromParentPathAndName(t,e){return Qt.concatenate(t,"/",Qt.preEncodeSpecialCharactersInPath(e))}static urlFromParentUrlAndName(t,e){return Qt.concatenate(t,"/",Qt.preEncodeSpecialCharactersInPath(e))}static encodedPathToRawPathString(t){return decodeURIComponent(t)}static rawPathToUrlString(t){let e=Qt.preEncodeSpecialCharactersInPath(t.replace(/\\/g,"/"));return e=e.replace(/\\/g,"/"),e.startsWith("file://")||(e=e.startsWith("/")?"file://"+e:"file:///"+e),new URL(e).toString()}static relativePathToUrlString(t,e){const r=Qt.preEncodeSpecialCharactersInPath(t.replace(/\\/g,"/"));return new URL(r,e).toString()}static urlToRawPathString(t,e){console.assert(t.startsWith("file://"),"This must be a file URL.");const r=decodeURIComponent(t);return e?r.substr("file:///".length).replace(/\//g,"\\"):r.substr("file://".length)}static sliceUrlToEncodedPathString(t,e){return t.substring(e)}static substr(t,e,r){return t.substr(e,r)}static substring(t,e,r){return t.substring(e,r)}static prepend(t,e){return t+e}static concatenate(t,...e){return t.concat(...e)}static trim(t){return t.trim()}static slice(t,e,r){return t.slice(e,r)}static join(t,e){return t.join(e)}static split(t,e,r){return t.split(e,r)}static toLowerCase(t){return t.toLowerCase()}static isValidUrlString(t){return new Qt(t).isValid}static urlWithoutHash(t){const e=t.indexOf("#");return-1!==e?t.substr(0,e):t}static urlRegex(){if(Qt.urlRegexInstance)return Qt.urlRegexInstance;return Qt.urlRegexInstance=new RegExp("^("+/([A-Za-z][A-Za-z0-9+.-]*):\/\//.source+/(?:([A-Za-z0-9\-._~%!$&'()*+,;=:]*)@)?/.source+/((?:\[::\d?\])|(?:[^\s\/:]*))/.source+/(?::([\d]+))?/.source+")"+/(\/[^#?]*)?/.source+/(?:\?([^#]*))?/.source+/(?:#(.*))?/.source+"$"),Qt.urlRegexInstance}static extractPath(t){const e=this.fromString(t);return e?e.path:""}static extractOrigin(t){const r=this.fromString(t);return r?r.securityOrigin():e.DevToolsPath.EmptyUrlString}static extractExtension(t){const e=(t=Qt.urlWithoutHash(t)).indexOf("?");-1!==e&&(t=t.substr(0,e));const r=t.lastIndexOf("/");-1!==r&&(t=t.substr(r+1));const s=t.lastIndexOf(".");if(-1!==s){const e=(t=t.substr(s+1)).indexOf("%");return-1!==e?t.substr(0,e):t}return""}static extractName(t){let e=t.lastIndexOf("/");const r=-1!==e?t.substr(e+1):t;return e=r.indexOf("?"),e<0?r:r.substr(0,e)}static completeURL(t,e){const r=e.trim();if(r.startsWith("data:")||r.startsWith("blob:")||r.startsWith("javascript:")||r.startsWith("mailto:"))return e;const s=this.fromString(r);if(s&&s.scheme){return s.securityOrigin()+Jt(s.path)+(s.queryParams&&`?${s.queryParams}`)+(s.fragment&&`#${s.fragment}`)}const n=this.fromString(t);if(!n)return null;if(n.isDataURL())return e;if(e.length>1&&"/"===e.charAt(0)&&"/"===e.charAt(1))return n.scheme+":"+e;const i=n.securityOrigin(),a=n.path,o=n.queryParams?"?"+n.queryParams:"";if(!e.length)return i+a+o;if("#"===e.charAt(0))return i+a+o+e;if("?"===e.charAt(0))return i+a+e;const l=e.match(/^[^#?]*/);if(!l||!e.length)throw new Error("Invalid href");let h=l[0];const c=e.substring(h.length);return"/"!==h.charAt(0)&&(h=n.folderPathComponents+"/"+h),i+Jt(h)+c}static splitLineAndColumn(t){const e=t.match(Qt.urlRegex());let r="",s=t;e&&(r=e[1],s=t.substring(e[1].length));const n=/(?::(\d+))?(?::(\d+))?$/.exec(s);let i,a;if(console.assert(Boolean(n)),!n)return{url:t,lineNumber:0,columnNumber:0};"string"==typeof n[1]&&(i=parseInt(n[1],10),i=isNaN(i)?void 0:i-1),"string"==typeof n[2]&&(a=parseInt(n[2],10),a=isNaN(a)?void 0:a-1);let o=r+s.substring(0,s.length-n[0].length);if(void 0===n[1]&&void 0===n[2]){const t=/wasm-function\[\d+\]:0x([a-z0-9]+)$/g.exec(s);t&&"string"==typeof t[1]&&(o=Qt.removeWasmFunctionInfoFromURL(o),a=parseInt(t[1],16),a=isNaN(a)?void 0:a)}return{url:o,lineNumber:i,columnNumber:a}}static removeWasmFunctionInfoFromURL(t){const e=t.search(/:wasm-function\[\d+\]/);return-1===e?t:Qt.substring(t,0,e)}static beginsWithWindowsDriveLetter(t){return/^[A-Za-z]:/.test(t)}static beginsWithScheme(t){return/^[A-Za-z][A-Za-z0-9+.-]*:/.test(t)}static isRelativeURL(t){return!this.beginsWithScheme(t)||this.beginsWithWindowsDriveLetter(t)}get displayName(){return this.#x?this.#x:this.isDataURL()?this.dataURLDisplayName():this.isBlobURL()||this.isAboutBlank()?this.url:(this.#x=this.lastPathComponent,this.#x||(this.#x=(this.host||"")+"/"),"/"===this.#x&&(this.#x=this.url),this.#x)}dataURLDisplayName(){return this.#T?this.#T:this.isDataURL()?(this.#T=e.StringUtilities.trimEndWithMaxLength(this.url,20),this.#T):""}isAboutBlank(){return"about:blank"===this.url}isDataURL(){return"data"===this.scheme}isHttpOrHttps(){return"http"===this.scheme||"https"===this.scheme}isBlobURL(){return this.url.startsWith("blob:")}lastPathComponentWithFragment(){return this.lastPathComponent+(this.fragment?"#"+this.fragment:"")}domain(){return this.isDataURL()?"data:":this.host+(this.port?":"+this.port:"")}securityOrigin(){if(this.isDataURL())return"data:";return(this.isBlobURL()?this.blobInnerScheme:this.scheme)+"://"+this.domain()}urlWithoutScheme(){return this.scheme&&this.url.startsWith(this.scheme+"://")?this.url.substring(this.scheme.length+3):this.url}static urlRegexInstance=null}var te=Object.freeze({__proto__:null,normalizePath:Jt,ParsedURL:Qt});class ee{#R;#v;#z;#A;constructor(t,e){this.#R=t,this.#v=e||1,this.#z=0,this.#A=0}isCanceled(){return this.#R.parent.isCanceled()}setTitle(t){this.#R.parent.setTitle(t)}done(){this.setWorked(this.#A),this.#R.childDone()}setTotalWork(t){this.#A=t,this.#R.update()}setWorked(t,e){this.#z=t,void 0!==e&&this.setTitle(e),this.#R.update()}incrementWorked(t){this.setWorked(this.#z+(t||1))}getWeight(){return this.#v}getWorked(){return this.#z}getTotalWork(){return this.#A}}var re=Object.freeze({__proto__:null,Progress:class{setTotalWork(t){}setTitle(t){}setWorked(t,e){}incrementWorked(t){}done(){}isCanceled(){return!1}},CompositeProgress:class{parent;#I;#P;constructor(t){this.parent=t,this.#I=[],this.#P=0,this.parent.setTotalWork(1),this.parent.setWorked(0)}childDone(){++this.#P===this.#I.length&&this.parent.done()}createSubProgress(t){const e=new ee(this,t);return this.#I.push(e),e}update(){let t=0,e=0;for(let r=0;r<this.#I.length;++r){const s=this.#I[r];s.getTotalWork()&&(e+=s.getWeight()*s.getWorked()/s.getTotalWork()),t+=s.getWeight()}this.parent.setWorked(e/t)}},SubProgress:ee,ProgressProxy:class{#E;#k;constructor(t,e){this.#E=t,this.#k=e}isCanceled(){return!!this.#E&&this.#E.isCanceled()}setTitle(t){this.#E&&this.#E.setTitle(t)}done(){this.#E&&this.#E.done(),this.#k&&this.#k()}setTotalWork(t){this.#E&&this.#E.setTotalWork(t)}setWorked(t,e){this.#E&&this.#E.setWorked(t,e)}incrementWorked(t){this.#E&&this.#E.incrementWorked(t)}}}),se=Object.freeze({__proto__:null});var ne=Object.freeze({__proto__:null,ResolverBase:class{#L=new Map;async waitFor(t){const e=this.getForId(t);return e||this.getOrCreatePromise(t)}tryGet(t,e){const r=this.getForId(t);if(!r){const r=()=>{};return this.getOrCreatePromise(t).catch(r).then((t=>{t&&e(t)})),null}return r}clear(){this.stopListening();for(const[t,{reject:e}]of this.#L.entries())e(new Error(`Object with ${t} never resolved.`));this.#L.clear()}getOrCreatePromise(t){const e=this.#L.get(t);if(e)return e.promise;let r=()=>{},s=()=>{};const n=new Promise(((t,e)=>{r=t,s=e}));return this.#L.set(t,{promise:n,resolve:r,reject:s}),this.startListening(),n}onResolve(t,e){const r=this.#L.get(t);this.#L.delete(t),0===this.#L.size&&this.stopListening(),r?.resolve(e)}}});const ie={xhrAndFetch:"`XHR` and `Fetch`",scripts:"Scripts",js:"JS",stylesheets:"Stylesheets",css:"CSS",images:"Images",img:"Img",media:"Media",fonts:"Fonts",font:"Font",documents:"Documents",doc:"Doc",websockets:"WebSockets",ws:"WS",webassembly:"WebAssembly",wasm:"Wasm",manifest:"Manifest",other:"Other",document:"Document",stylesheet:"Stylesheet",image:"Image",script:"Script",texttrack:"TextTrack",fetch:"Fetch",eventsource:"EventSource",websocket:"WebSocket",webtransport:"WebTransport",signedexchange:"SignedExchange",ping:"Ping",cspviolationreport:"CSPViolationReport",preflight:"Preflight",webbundle:"WebBundle"},ae=r.i18n.registerUIStrings("core/common/ResourceType.ts",ie),oe=r.i18n.getLazilyComputedLocalizedString.bind(void 0,ae);class le{#B;#O;#C;#N;constructor(t,e,r,s){this.#B=t,this.#O=e,this.#C=r,this.#N=s}static fromMimeType(t){return t?t.startsWith("text/html")?ue.Document:t.startsWith("text/css")?ue.Stylesheet:t.startsWith("image/")?ue.Image:t.startsWith("text/")?ue.Script:t.includes("font")?ue.Font:t.includes("script")?ue.Script:t.includes("octet")?ue.Other:t.includes("application")?ue.Script:ue.Other:ue.Other}static fromMimeTypeOverride(t){return"application/manifest+json"===t?ue.Manifest:"application/wasm"===t?ue.Wasm:"application/webbundle"===t?ue.WebBundle:null}static fromURL(t){return de.get(Qt.extractExtension(t))||null}static fromName(t){for(const e in ue){const r=ue[e];if(r.name()===t)return r}return null}static mimeFromURL(t){const e=Qt.extractName(t);if(ge.has(e))return ge.get(e);let r=Qt.extractExtension(t).toLowerCase();return"html"===r&&e.endsWith(".component.html")&&(r="component.html"),pe.get(r)}static mimeFromExtension(t){return pe.get(t)}static mediaTypeForMetrics(t,e,r){return"text/javascript"!==t?t:e?"text/javascript+sourcemapped":r?"text/javascript+minified":"text/javascript+plain"}name(){return this.#B}title(){return this.#O()}category(){return this.#C}isTextType(){return this.#N}isScript(){return"script"===this.#B||"sm-script"===this.#B}hasScripts(){return this.isScript()||this.isDocument()}isStyleSheet(){return"stylesheet"===this.#B||"sm-stylesheet"===this.#B}hasStyleSheets(){return this.isStyleSheet()||this.isDocument()}isDocument(){return"document"===this.#B}isDocumentOrScriptOrStyleSheet(){return this.isDocument()||this.isScript()||this.isStyleSheet()}isFont(){return"font"===this.#B}isImage(){return"image"===this.#B}isFromSourceMap(){return this.#B.startsWith("sm-")}isWebbundle(){return"webbundle"===this.#B}toString(){return this.#B}canonicalMimeType(){return this.isDocument()?"text/html":this.isScript()?"text/javascript":this.isStyleSheet()?"text/css":""}}class he{title;shortTitle;constructor(t,e){this.title=t,this.shortTitle=e}}const ce={XHR:new he(oe(ie.xhrAndFetch),r.i18n.lockedLazyString("Fetch/XHR")),Script:new he(oe(ie.scripts),oe(ie.js)),Stylesheet:new he(oe(ie.stylesheets),oe(ie.css)),Image:new he(oe(ie.images),oe(ie.img)),Media:new he(oe(ie.media),oe(ie.media)),Font:new he(oe(ie.fonts),oe(ie.font)),Document:new he(oe(ie.documents),oe(ie.doc)),WebSocket:new he(oe(ie.websockets),oe(ie.ws)),Wasm:new he(oe(ie.webassembly),oe(ie.wasm)),Manifest:new he(oe(ie.manifest),oe(ie.manifest)),Other:new he(oe(ie.other),oe(ie.other))},ue={Document:new le("document",oe(ie.document),ce.Document,!0),Stylesheet:new le("stylesheet",oe(ie.stylesheet),ce.Stylesheet,!0),Image:new le("image",oe(ie.image),ce.Image,!1),Media:new le("media",oe(ie.media),ce.Media,!1),Font:new le("font",oe(ie.font),ce.Font,!1),Script:new le("script",oe(ie.script),ce.Script,!0),TextTrack:new le("texttrack",oe(ie.texttrack),ce.Other,!0),XHR:new le("xhr",r.i18n.lockedLazyString("XHR"),ce.XHR,!0),Fetch:new le("fetch",oe(ie.fetch),ce.XHR,!0),Prefetch:new le("prefetch",r.i18n.lockedLazyString("Prefetch"),ce.Document,!0),EventSource:new le("eventsource",oe(ie.eventsource),ce.XHR,!0),WebSocket:new le("websocket",oe(ie.websocket),ce.WebSocket,!1),WebTransport:new le("webtransport",oe(ie.webtransport),ce.WebSocket,!1),Wasm:new le("wasm",oe(ie.wasm),ce.Wasm,!1),Manifest:new le("manifest",oe(ie.manifest),ce.Manifest,!0),SignedExchange:new le("signed-exchange",oe(ie.signedexchange),ce.Other,!1),Ping:new le("ping",oe(ie.ping),ce.Other,!1),CSPViolationReport:new le("csp-violation-report",oe(ie.cspviolationreport),ce.Other,!1),Other:new le("other",oe(ie.other),ce.Other,!1),Preflight:new le("preflight",oe(ie.preflight),ce.Other,!0),SourceMapScript:new le("sm-script",oe(ie.script),ce.Script,!0),SourceMapStyleSheet:new le("sm-stylesheet",oe(ie.stylesheet),ce.Stylesheet,!0),WebBundle:new le("webbundle",oe(ie.webbundle),ce.Other,!1)},ge=new Map([["Cakefile","text/x-coffeescript"]]),de=new Map([["js",ue.Script],["mjs",ue.Script],["css",ue.Stylesheet],["xsl",ue.Stylesheet],["avif",ue.Image],["bmp",ue.Image],["gif",ue.Image],["ico",ue.Image],["jpeg",ue.Image],["jpg",ue.Image],["jxl",ue.Image],["png",ue.Image],["svg",ue.Image],["tif",ue.Image],["tiff",ue.Image],["vue",ue.Document],["webmanifest",ue.Manifest],["webp",ue.Media],["otf",ue.Font],["ttc",ue.Font],["ttf",ue.Font],["woff",ue.Font],["woff2",ue.Font],["wasm",ue.Wasm]]),pe=new Map([["js","text/javascript"],["mjs","text/javascript"],["css","text/css"],["html","text/html"],["htm","text/html"],["xml","application/xml"],["xsl","application/xml"],["wasm","application/wasm"],["webmanifest","application/manifest+json"],["asp","application/x-aspx"],["aspx","application/x-aspx"],["jsp","application/x-jsp"],["c","text/x-c++src"],["cc","text/x-c++src"],["cpp","text/x-c++src"],["h","text/x-c++src"],["m","text/x-c++src"],["mm","text/x-c++src"],["coffee","text/x-coffeescript"],["dart","application/vnd.dart"],["ts","text/typescript"],["tsx","text/typescript-jsx"],["json","application/json"],["gyp","application/json"],["gypi","application/json"],["map","application/json"],["cs","text/x-csharp"],["go","text/x-go"],["java","text/x-java"],["kt","text/x-kotlin"],["scala","text/x-scala"],["less","text/x-less"],["php","application/x-httpd-php"],["phtml","application/x-httpd-php"],["py","text/x-python"],["sh","text/x-sh"],["gss","text/x-gss"],["sass","text/x-sass"],["scss","text/x-scss"],["vtt","text/vtt"],["ls","text/x-livescript"],["md","text/markdown"],["cljs","text/x-clojure"],["cljc","text/x-clojure"],["cljx","text/x-clojure"],["styl","text/x-styl"],["jsx","text/jsx"],["avif","image/avif"],["bmp","image/bmp"],["gif","image/gif"],["ico","image/ico"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["jxl","image/jxl"],["png","image/png"],["svg","image/svg+xml"],["tif","image/tif"],["tiff","image/tiff"],["webp","image/webp"],["otf","font/otf"],["ttc","font/collection"],["ttf","font/ttf"],["woff","font/woff"],["woff2","font/woff2"],["component.html","text/x.angular"],["svelte","text/x.svelte"],["vue","text/x.vue"]]);var me=Object.freeze({__proto__:null,ResourceType:le,ResourceCategory:he,resourceCategories:ce,resourceTypes:ue,resourceTypeByExtension:de,mimeTypeByExtension:pe});const ye=new Map;const fe=[];var we=Object.freeze({__proto__:null,registerLateInitializationRunnable:function(t){const{id:e,loadRunnable:r}=t;if(ye.has(e))throw new Error(`Duplicate late Initializable runnable id '${e}'`);ye.set(e,r)},maybeRemoveLateInitializationRunnable:function(t){return ye.delete(t)},lateInitializationRunnables:function(){return[...ye.values()]},registerEarlyInitializationRunnable:function(t){fe.push(t)},earlyInitializationRunnables:function(){return fe}});class be{begin;end;data;constructor(t,e,r){if(t>e)throw new Error("Invalid segment");this.begin=t,this.end=e,this.data=r}intersects(t){return this.begin<t.end&&t.begin<this.end}}var Se=Object.freeze({__proto__:null,Segment:be,SegmentedRange:class{#G;#_;constructor(t){this.#G=[],this.#_=t}append(t){let r=e.ArrayUtilities.lowerBound(this.#G,t,((t,e)=>t.begin-e.begin)),s=r,n=null;if(r>0){const e=this.#G[r-1];n=this.tryMerge(e,t),n?(--r,t=n):this.#G[r-1].end>=t.begin&&(t.end<e.end&&this.#G.splice(r,0,new be(t.end,e.end,e.data)),e.end=t.begin)}for(;s<this.#G.length&&this.#G[s].end<=t.end;)++s;s<this.#G.length&&(n=this.tryMerge(t,this.#G[s]),n?(s++,t=n):t.intersects(this.#G[s])&&(this.#G[s].begin=t.end)),this.#G.splice(r,s-r,t)}appendRange(t){t.segments().forEach((t=>this.append(t)))}segments(){return this.#G}tryMerge(t,e){const r=this.#_&&this.#_(t,e);return r?(r.begin=t.begin,r.end=Math.max(t.end,e.end),r):null}}});const xe={elements:"Elements",appearance:"Appearance",sources:"Sources",network:"Network",performance:"Performance",console:"Console",persistence:"Persistence",debugger:"Debugger",global:"Global",rendering:"Rendering",grid:"Grid",mobile:"Mobile",memory:"Memory",extension:"Extension",adorner:"Adorner",sync:"Sync"},Te=r.i18n.registerUIStrings("core/common/SettingRegistration.ts",xe),Re=r.i18n.getLocalizedString.bind(void 0,Te);let ve=[];const ze=new Set;function Ae(t){const e=t.settingName;if(ze.has(e))throw new Error(`Duplicate setting name '${e}'`);ze.add(e),ve.push(t)}function Ie(){return ve.filter((e=>t.Runtime.Runtime.isDescriptorEnabled({experiment:e.experiment,condition:e.condition})))}function Pe(t,e=!1){if(0===ve.length||e){ve=t,ze.clear();for(const e of t){const t=e.settingName;if(ze.has(t))throw new Error(`Duplicate setting name '${t}'`);ze.add(t)}}}function Ee(){ve=[],ze.clear()}function ke(t){const e=ve.findIndex((e=>e.settingName===t));return!(e<0||!ze.delete(t))&&(ve.splice(e,1),!0)}var Le,Be;function Oe(t){switch(t){case Le.ELEMENTS:return Re(xe.elements);case Le.APPEARANCE:return Re(xe.appearance);case Le.SOURCES:return Re(xe.sources);case Le.NETWORK:return Re(xe.network);case Le.PERFORMANCE:return Re(xe.performance);case Le.CONSOLE:return Re(xe.console);case Le.PERSISTENCE:return Re(xe.persistence);case Le.DEBUGGER:return Re(xe.debugger);case Le.GLOBAL:return Re(xe.global);case Le.RENDERING:return Re(xe.rendering);case Le.GRID:return Re(xe.grid);case Le.MOBILE:return Re(xe.mobile);case Le.EMULATION:return Re(xe.console);case Le.MEMORY:return Re(xe.memory);case Le.EXTENSIONS:return Re(xe.extension);case Le.ADORNER:return Re(xe.adorner);case Le.NONE:return r.i18n.lockedString("");case Le.SYNC:return Re(xe.sync)}}!function(t){t.NONE="",t.ELEMENTS="ELEMENTS",t.APPEARANCE="APPEARANCE",t.SOURCES="SOURCES",t.NETWORK="NETWORK",t.PERFORMANCE="PERFORMANCE",t.CONSOLE="CONSOLE",t.PERSISTENCE="PERSISTENCE",t.DEBUGGER="DEBUGGER",t.GLOBAL="GLOBAL",t.RENDERING="RENDERING",t.GRID="GRID",t.MOBILE="MOBILE",t.EMULATION="EMULATION",t.MEMORY="MEMORY",t.EXTENSIONS="EXTENSIONS",t.ADORNER="ADORNER",t.SYNC="SYNC"}(Le||(Le={})),function(t){t.ARRAY="array",t.REGEX="regex",t.ENUM="enum",t.BOOLEAN="boolean"}(Be||(Be={}));var Ce=Object.freeze({__proto__:null,registerSettingExtension:Ae,getRegisteredSettings:Ie,registerSettingsForTest:Pe,resetSettings:Ee,maybeRemoveSettingExtension:ke,get SettingCategory(){return Le},getLocalizedSettingsCategory:Oe,get SettingType(){return Be}});let Ne;class Ge{syncedStorage;globalStorage;localStorage;#V;settingNameSet;orderValuesBySettingCategory;#M;#W;moduleSettings;constructor(e,r,s){this.syncedStorage=e,this.globalStorage=r,this.localStorage=s,this.#V=new Ve({}),this.settingNameSet=new Set,this.orderValuesBySettingCategory=new Map,this.#M=new At,this.#W=new Map,this.moduleSettings=new Map;for(const e of Ie()){const{settingName:r,defaultValue:s,storageType:n}=e,i=e.settingType===Be.REGEX&&"string"==typeof s?this.createRegExpSetting(r,s,void 0,n):this.createSetting(r,s,n);"mac"===t.Runtime.Runtime.platform()&&e.titleMac?i.setTitleFunction(e.titleMac):i.setTitleFunction(e.title),e.userActionCondition&&i.setRequiresUserAction(Boolean(t.Runtime.Runtime.queryParam(e.userActionCondition))),i.setRegistration(e),this.registerModuleSetting(i)}}static hasInstance(){return void 0!==Ne}static instance(t={forceNew:null,syncedStorage:null,globalStorage:null,localStorage:null}){const{forceNew:e,syncedStorage:r,globalStorage:s,localStorage:n}=t;if(!Ne||e){if(!r||!s||!n)throw new Error(`Unable to create settings: global and local storage must be provided: ${(new Error).stack}`);Ne=new Ge(r,s,n)}return Ne}static removeInstance(){Ne=void 0}registerModuleSetting(t){const e=t.name,r=t.category(),s=t.order();if(this.settingNameSet.has(e))throw new Error(`Duplicate Setting name '${e}'`);if(r&&s){const t=this.orderValuesBySettingCategory.get(r)||new Set;if(t.has(s))throw new Error(`Duplicate order value '${s}' for settings category '${r}'`);t.add(s),this.orderValuesBySettingCategory.set(r,t)}this.settingNameSet.add(e),this.moduleSettings.set(t.name,t)}moduleSetting(t){const e=this.moduleSettings.get(t);if(!e)throw new Error("No setting registered: "+t);return e}settingForTest(t){const e=this.#W.get(t);if(!e)throw new Error("No setting registered: "+t);return e}createSetting(t,e,r){const s=this.storageFromType(r);let n=this.#W.get(t);return n||(n=new Xe(t,e,this.#M,s),this.#W.set(t,n)),n}createLocalSetting(t,e){return this.createSetting(t,e,Ue.Local)}createRegExpSetting(t,e,r,s){return this.#W.get(t)||this.#W.set(t,new Fe(t,e,this.#M,this.storageFromType(s),r)),this.#W.get(t)}clearAll(){this.globalStorage.removeAll(),this.syncedStorage.removeAll(),this.localStorage.removeAll(),(new De).resetToCurrent()}storageFromType(t){switch(t){case Ue.Local:return this.localStorage;case Ue.Session:return this.#V;case Ue.Global:return this.globalStorage;case Ue.Synced:return this.syncedStorage}return this.globalStorage}getRegistry(){return this.#W}}const _e={register:()=>{},set:()=>{},get:()=>Promise.resolve(""),remove:()=>{},clear:()=>{}};class Ve{object;backingStore;storagePrefix;constructor(t,e=_e,r=""){this.object=t,this.backingStore=e,this.storagePrefix=r}register(t){t=this.storagePrefix+t,this.backingStore.register(t)}set(t,e){t=this.storagePrefix+t,this.object[t]=e,this.backingStore.set(t,e)}has(t){return(t=this.storagePrefix+t)in this.object}get(t){return t=this.storagePrefix+t,this.object[t]}async forceGet(t){const e=this.storagePrefix+t,r=await this.backingStore.get(e);return r&&r!==this.object[e]?this.set(t,r):r||this.remove(t),r}remove(t){t=this.storagePrefix+t,delete this.object[t],this.backingStore.remove(t)}removeAll(){this.object={},this.backingStore.clear()}dumpSizes(){_t.instance().log("Ten largest settings: ");const t={__proto__:null};for(const e in this.object)t[e]=this.object[e].length;const e=Object.keys(t);e.sort((function(e,r){return t[r]-t[e]}));for(let r=0;r<10&&r<e.length;++r)_t.instance().log("Setting: '"+e[r]+"', size: "+t[e[r]])}}function Me(t){const e=t.name,r=Ge.instance();r.getRegistry().delete(e),r.moduleSettings.delete(e),t.storage.remove(e)}class We{disabled;warning;experiment;constructor({deprecationNotice:e}){if(!e)throw new Error("Cannot create deprecation info for a non-deprecated setting");this.disabled=e.disabled,this.warning=e.warning(),this.experiment=e.experiment?t.Runtime.experiments.allConfigurableExperiments().find((t=>t.name===e.experiment)):void 0}}class Xe{name;defaultValue;eventSupport;storage;#X;#O;#F=null;#D;#U;#j=JSON;#$;#H;#q=null;constructor(t,e,r,s){this.name=t,this.defaultValue=e,this.eventSupport=r,this.storage=s,s.register(t)}setSerializer(t){this.#j=t}addChangeListener(t,e){return this.eventSupport.addEventListener(this.name,t,e)}removeChangeListener(t,e){this.eventSupport.removeEventListener(this.name,t,e)}title(){return this.#O?this.#O:this.#X?this.#X():""}setTitleFunction(t){t&&(this.#X=t)}setTitle(t){this.#O=t}setRequiresUserAction(t){this.#D=t}disabled(){return this.#H||!1}setDisabled(t){this.#H=t,this.eventSupport.dispatchEventToListeners(this.name)}get(){if(this.#D&&!this.#$)return this.defaultValue;if(void 0!==this.#U)return this.#U;if(this.#U=this.defaultValue,this.storage.has(this.name))try{this.#U=this.#j.parse(this.storage.get(this.name))}catch(t){this.storage.remove(this.name)}return this.#U}async forceGet(){const t=this.name,e=this.storage.get(t),r=await this.storage.forceGet(t);if(this.#U=this.defaultValue,r)try{this.#U=this.#j.parse(r)}catch(t){this.storage.remove(this.name)}return e!==r&&this.eventSupport.dispatchEventToListeners(this.name,this.#U),this.#U}set(t){this.#$=!0,this.#U=t;try{const e=this.#j.stringify(t);try{this.storage.set(this.name,e)}catch(t){this.printSettingsSavingError(t.message,this.name,e)}}catch(t){_t.instance().error("Cannot stringify setting with name: "+this.name+", error: "+t.message)}this.eventSupport.dispatchEventToListeners(this.name,t)}setRegistration(e){this.#F=e;const{deprecationNotice:r}=e;if(r?.disabled){const e=r.experiment?t.Runtime.experiments.allConfigurableExperiments().find((t=>t.name===r.experiment)):void 0;e&&!e.isEnabled()||(this.set(this.defaultValue),this.setDisabled(!0))}}type(){return this.#F?this.#F.settingType:null}options(){return this.#F&&this.#F.options?this.#F.options.map((t=>{const{value:e,title:r,text:s,raw:n}=t;return{value:e,title:r(),text:"function"==typeof s?s():s,raw:n}})):[]}reloadRequired(){return this.#F&&this.#F.reloadRequired||null}category(){return this.#F&&this.#F.category||null}tags(){return this.#F&&this.#F.tags?this.#F.tags.map((t=>t())).join("\0"):null}order(){return this.#F&&this.#F.order||null}get deprecation(){return this.#F&&this.#F.deprecationNotice?(this.#q||(this.#q=new We(this.#F)),this.#q):null}printSettingsSavingError(t,e,r){const s="Error saving setting with name: "+this.name+", value length: "+r.length+". Error: "+t;console.error(s),_t.instance().error(s),this.storage.dumpSizes()}}class Fe extends Xe{#Y;#Z;constructor(t,e,r,s,n){super(t,e?[{pattern:e}]:[],r,s),this.#Y=n}get(){const t=[],e=this.getAsArray();for(let r=0;r<e.length;++r){const s=e[r];s.pattern&&!s.disabled&&t.push(s.pattern)}return t.join("|")}getAsArray(){return super.get()}set(t){this.setAsArray([{pattern:t,disabled:!1}])}setAsArray(t){this.#Z=void 0,super.set(t)}asRegExp(){if(void 0!==this.#Z)return this.#Z;this.#Z=null;try{const t=this.get();t&&(this.#Z=new RegExp(t,this.#Y||""))}catch(t){}return this.#Z}}class De{static GLOBAL_VERSION_SETTING_NAME="inspectorVersion";static SYNCED_VERSION_SETTING_NAME="syncedInspectorVersion";static LOCAL_VERSION_SETTING_NAME="localInspectorVersion";static CURRENT_VERSION=35;#K;#J;#Q;constructor(){this.#K=Ge.instance().createSetting(De.GLOBAL_VERSION_SETTING_NAME,De.CURRENT_VERSION,Ue.Global),this.#J=Ge.instance().createSetting(De.SYNCED_VERSION_SETTING_NAME,De.CURRENT_VERSION,Ue.Synced),this.#Q=Ge.instance().createSetting(De.LOCAL_VERSION_SETTING_NAME,De.CURRENT_VERSION,Ue.Local)}resetToCurrent(){this.#K.set(De.CURRENT_VERSION),this.#J.set(De.CURRENT_VERSION),this.#Q.set(De.CURRENT_VERSION)}updateVersion(){const t=De.CURRENT_VERSION,e=Math.min(this.#K.get(),this.#J.get(),this.#Q.get()),r=this.methodsToRunToUpdateVersion(e,t);console.assert(void 0===this[`updateVersionFrom${t}To${t+1}`],"Unexpected migration method found. Increment CURRENT_VERSION or remove the method.");for(const t of r)this[t].call(this);this.resetToCurrent()}methodsToRunToUpdateVersion(t,e){const r=[];for(let s=t;s<e;++s)r.push("updateVersionFrom"+s+"To"+(s+1));return r}updateVersionFrom0To1(){this.clearBreakpointsWhenTooMany(Ge.instance().createLocalSetting("breakpoints",[]),5e5)}updateVersionFrom1To2(){Ge.instance().createSetting("previouslyViewedFiles",[]).set([])}updateVersionFrom2To3(){Ge.instance().createSetting("fileSystemMapping",{}).set({}),Me(Ge.instance().createSetting("fileMappingEntries",[]))}updateVersionFrom3To4(){const t=Ge.instance().createSetting("showHeaSnapshotObjectsHiddenProperties",!1);je("showAdvancedHeapSnapshotProperties").set(t.get()),Me(t)}updateVersionFrom4To5(){const t={FileSystemViewSidebarWidth:"fileSystemViewSplitViewState",elementsSidebarWidth:"elementsPanelSplitViewState",StylesPaneSplitRatio:"stylesPaneSplitViewState",heapSnapshotRetainersViewSize:"heapSnapshotSplitViewState","InspectorView.splitView":"InspectorView.splitViewState","InspectorView.screencastSplitView":"InspectorView.screencastSplitViewState","Inspector.drawerSplitView":"Inspector.drawerSplitViewState",layerDetailsSplitView:"layerDetailsSplitViewState",networkSidebarWidth:"networkPanelSplitViewState",sourcesSidebarWidth:"sourcesPanelSplitViewState",scriptsPanelNavigatorSidebarWidth:"sourcesPanelNavigatorSplitViewState",sourcesPanelSplitSidebarRatio:"sourcesPanelDebuggerSidebarSplitViewState","timeline-details":"timelinePanelDetailsSplitViewState","timeline-split":"timelinePanelRecorsSplitViewState","timeline-view":"timelinePanelTimelineStackSplitViewState",auditsSidebarWidth:"auditsPanelSplitViewState",layersSidebarWidth:"layersPanelSplitViewState",profilesSidebarWidth:"profilesPanelSplitViewState",resourcesSidebarWidth:"resourcesPanelSplitViewState"},e={};for(const r in t){const s=t[r],n=r+"H";let i=null;const a=Ge.instance().createSetting(r,e);a.get()!==e&&(i=i||{},i.vertical={},i.vertical.size=a.get(),Me(a));const o=Ge.instance().createSetting(n,e);o.get()!==e&&(i=i||{},i.horizontal={},i.horizontal.size=o.get(),Me(o)),i&&Ge.instance().createSetting(s,{}).set(i)}}updateVersionFrom5To6(){const t={debuggerSidebarHidden:"sourcesPanelSplitViewState",navigatorHidden:"sourcesPanelNavigatorSplitViewState","WebInspector.Drawer.showOnLoad":"Inspector.drawerSplitViewState"};for(const e in t){const r=Ge.instance().createSetting(e,null);if(null===r.get()){Me(r);continue}const s=t[e],n="WebInspector.Drawer.showOnLoad"===e,i=r.get()!==n;Me(r);const a=i?"OnlyMain":"Both",o=Ge.instance().createSetting(s,{}),l=o.get()||{};l.vertical=l.vertical||{},l.vertical.showMode=a,l.horizontal=l.horizontal||{},l.horizontal.showMode=a,o.set(l)}}updateVersionFrom6To7(){const t={sourcesPanelNavigatorSplitViewState:"sourcesPanelNavigatorSplitViewState",elementsPanelSplitViewState:"elementsPanelSplitViewState",stylesPaneSplitViewState:"stylesPaneSplitViewState",sourcesPanelDebuggerSidebarSplitViewState:"sourcesPanelDebuggerSidebarSplitViewState"},e={};for(const r in t){const t=Ge.instance().createSetting(r,e),s=t.get();s!==e&&(s.vertical&&s.vertical.size&&s.vertical.size<1&&(s.vertical.size=0),s.horizontal&&s.horizontal.size&&s.horizontal.size<1&&(s.horizontal.size=0),t.set(s))}}updateVersionFrom7To8(){}updateVersionFrom8To9(){const t=["skipStackFramesPattern","workspaceFolderExcludePattern"];for(let e=0;e<t.length;++e){const r=Ge.instance().createSetting(t[e],"");let s=r.get();if(!s)return;"string"==typeof s&&(s=[s]);for(let t=0;t<s.length;++t)"string"==typeof s[t]&&(s[t]={pattern:s[t]});r.set(s)}}updateVersionFrom9To10(){if(window.localStorage)for(const t in window.localStorage)t.startsWith("revision-history")&&window.localStorage.removeItem(t)}updateVersionFrom10To11(){const t=Ge.instance().createSetting("customDevicePresets",void 0),e=t.get();if(!Array.isArray(e))return;const r=[];for(let t=0;t<e.length;++t){const s=e[t],n={};n.title=s.title,n.type="unknown",n["user-agent"]=s.userAgent,n.capabilities=[],s.touch&&n.capabilities.push("touch"),s.mobile&&n.capabilities.push("mobile"),n.screen={},n.screen.vertical={width:s.width,height:s.height},n.screen.horizontal={width:s.height,height:s.width},n.screen["device-pixel-ratio"]=s.deviceScaleFactor,n.modes=[],n["show-by-default"]=!0,n.show="Default",r.push(n)}r.length&&Ge.instance().createSetting("customEmulatedDeviceList",[]).set(r),Me(t)}updateVersionFrom11To12(){this.migrateSettingsFromLocalStorage()}updateVersionFrom12To13(){this.migrateSettingsFromLocalStorage(),Me(Ge.instance().createSetting("timelineOverviewMode",""))}updateVersionFrom13To14(){const t={throughput:-1,latency:0};Ge.instance().createSetting("networkConditions",t).set(t)}updateVersionFrom14To15(){const t=Ge.instance().createLocalSetting("workspaceExcludedFolders",{}),e=t.get(),r={};for(const t in e){r[t]=[];for(const s of e[t])r[t].push(s.path)}t.set(r)}updateVersionFrom15To16(){const t=Ge.instance().createSetting("InspectorView.panelOrder",{}),e=t.get();for(const t of Object.keys(e))e[t]=10*(e[t]+1);t.set(e)}updateVersionFrom16To17(){const t=Ge.instance().createSetting("networkConditionsCustomProfiles",[]),e=t.get(),r=[];if(Array.isArray(e))for(const t of e)"string"==typeof t.title&&"object"==typeof t.value&&"number"==typeof t.value.throughput&&"number"==typeof t.value.latency&&r.push({title:t.title,value:{download:t.value.throughput,upload:t.value.throughput,latency:t.value.latency}});t.set(r)}updateVersionFrom17To18(){const t=Ge.instance().createLocalSetting("workspaceExcludedFolders",{}),e=t.get(),r={};for(const t in e){let s=t.replace(/\\/g,"/");s.startsWith("file://")||(s=s.startsWith("/")?"file://"+s:"file:///"+s),r[s]=e[t]}t.set(r)}updateVersionFrom18To19(){const t=Ge.instance().createSetting("networkLogColumnsVisibility",{status:!0,type:!0,initiator:!0,size:!0,time:!0}),e=t.get();e.name=!0,e.timeline=!0;const r={};for(const t in e)e.hasOwnProperty(t)&&(r[t.toLowerCase()]={visible:e[t]});Ge.instance().createSetting("networkLogColumns",{}).set(r),Me(t)}updateVersionFrom19To20(){const t=Ge.instance().createSetting("InspectorView.panelOrder",{});Ge.instance().createSetting("panel-tabOrder",{}).set(t.get()),Me(t)}updateVersionFrom20To21(){const t=Ge.instance().createSetting("networkLogColumns",{}),e=t.get();delete e.timeline,delete e.waterfall,t.set(e)}updateVersionFrom21To22(){const t=Ge.instance().createLocalSetting("breakpoints",[]),e=t.get();for(const t of e)t.url=t.sourceFileId,delete t.sourceFileId;t.set(e)}updateVersionFrom22To23(){}updateVersionFrom23To24(){const t=Ge.instance().createSetting("searchInContentScripts",!1);Ge.instance().createSetting("searchInAnonymousAndContentScripts",!1).set(t.get()),Me(t)}updateVersionFrom24To25(){const t=Ge.instance().createSetting("networkLogColumns",{status:!0,type:!0,initiator:!0,size:!0,time:!0}),e=t.get();delete e.product,t.set(e)}updateVersionFrom25To26(){const t=Ge.instance().createSetting("messageURLFilters",{}),e=Object.keys(t.get()).map((t=>`-url:${t}`)).join(" ");if(e){const t=Ge.instance().createSetting("console.textFilter",""),r=t.get()?` ${t.get()}`:"";t.set(`${e}${r}`)}Me(t)}updateVersionFrom26To27(){function t(t,e,r){const s=Ge.instance().createSetting(t,{}),n=s.get();e in n&&(n[r]=n[e],delete n[e],s.set(n))}t("panel-tabOrder","audits2","audits"),t("panel-closeableTabs","audits2","audits"),function(t,e,r){const s=Ge.instance().createSetting(t,"");s.get()===e&&s.set(r)}("panel-selectedTab","audits2","audits")}updateVersionFrom27To28(){const t=Ge.instance().createSetting("uiTheme","systemPreferred");"default"===t.get()&&t.set("systemPreferred")}updateVersionFrom28To29(){function t(t,e,r){const s=Ge.instance().createSetting(t,{}),n=s.get();e in n&&(n[r]=n[e],delete n[e],s.set(n))}t("panel-tabOrder","audits","lighthouse"),t("panel-closeableTabs","audits","lighthouse"),function(t,e,r){const s=Ge.instance().createSetting(t,"");s.get()===e&&s.set(r)}("panel-selectedTab","audits","lighthouse")}updateVersionFrom29To30(){const t=Ge.instance().createSetting("closeableTabs",{}),e=Ge.instance().createSetting("panel-closeableTabs",{}),r=Ge.instance().createSetting("drawer-view-closeableTabs",{}),s=e.get(),n=e.get(),i=Object.assign(n,s);t.set(i),Me(e),Me(r)}updateVersionFrom30To31(){Me(Ge.instance().createSetting("recorder_recordings",[]))}updateVersionFrom31To32(){const t=Ge.instance().createLocalSetting("breakpoints",[]),e=t.get();for(const t of e)t.resourceTypeName="script";t.set(e)}updateVersionFrom32To33(){const t=Ge.instance().createLocalSetting("previouslyViewedFiles",[]);let e=t.get();e=e.filter((t=>"url"in t));for(const t of e)t.resourceTypeName="script";t.set(e)}updateVersionFrom33To34(){const t=Ge.instance().createLocalSetting("breakpoints",[]),e=t.get();for(const t of e){const e=t.condition.startsWith("/** DEVTOOLS_LOGPOINT */ console.log(")&&t.condition.endsWith(")");t.isLogpoint=e}t.set(e)}updateVersionFrom34To35(){const t=Ge.instance().createLocalSetting("breakpoints",[]),e=t.get();for(const t of e){const{condition:e,isLogpoint:r}=t;r&&(t.condition=e.slice("/** DEVTOOLS_LOGPOINT */ console.log(".length,e.length-")".length))}t.set(e)}migrateSettingsFromLocalStorage(){const t=new Set(["advancedSearchConfig","breakpoints","consoleHistory","domBreakpoints","eventListenerBreakpoints","fileSystemMapping","lastSelectedSourcesSidebarPaneTab","previouslyViewedFiles","savedURLs","watchExpressions","workspaceExcludedFolders","xhrBreakpoints"]);if(window.localStorage)for(const e in window.localStorage){if(t.has(e))continue;const r=window.localStorage[e];window.localStorage.removeItem(e),Ge.instance().globalStorage.set(e,r)}}clearBreakpointsWhenTooMany(t,e){t.get().length>e&&t.set([])}}var Ue;function je(t){return Ge.instance().moduleSetting(t)}!function(t){t.Synced="Synced",t.Global="Global",t.Local="Local",t.Session="Session"}(Ue||(Ue={}));var $e=Object.freeze({__proto__:null,Settings:Ge,NOOP_STORAGE:_e,SettingsStorage:Ve,Deprecation:We,Setting:Xe,RegExpSetting:Fe,VersionController:De,get SettingStorageType(){return Ue},moduleSetting:je,settingForTest:function(t){return Ge.instance().settingForTest(t)},detectColorFormat:function(t){let e;const r=Ge.instance().moduleSetting("colorFormat").get();return e="rgb"===r?"rgb":"hsl"===r?"hsl":"hwb"===r?"hwb":"hex"===r?t.asLegacyColor().detectHEXFormat():t.format(),e},getLocalizedSettingsCategory:Oe,getRegisteredSettings:Ie,maybeRemoveSettingExtension:ke,registerSettingExtension:Ae,get SettingCategory(){return Le},get SettingType(){return Be},registerSettingsForTest:Pe,resetSettings:Ee});var He=Object.freeze({__proto__:null,SimpleHistoryManager:class{#tt;#et;#rt;#st;constructor(t){this.#tt=[],this.#et=-1,this.#rt=0,this.#st=t}readOnlyLock(){++this.#rt}releaseReadOnlyLock(){--this.#rt}getPreviousValidIndex(){if(this.empty())return-1;let t=this.#et-1;for(;t>=0&&!this.#tt[t].valid();)--t;return t<0?-1:t}getNextValidIndex(){let t=this.#et+1;for(;t<this.#tt.length&&!this.#tt[t].valid();)++t;return t>=this.#tt.length?-1:t}readOnly(){return Boolean(this.#rt)}filterOut(t){if(this.readOnly())return;const e=[];let r=0;for(let s=0;s<this.#tt.length;++s)t(this.#tt[s])?s<=this.#et&&++r:e.push(this.#tt[s]);this.#tt=e,this.#et=Math.max(0,this.#et-r)}empty(){return!this.#tt.length}active(){return this.empty()?null:this.#tt[this.#et]}push(t){this.readOnly()||(this.empty()||this.#tt.splice(this.#et+1),this.#tt.push(t),this.#tt.length>this.#st&&this.#tt.shift(),this.#et=this.#tt.length-1)}canRollback(){return this.getPreviousValidIndex()>=0}canRollover(){return this.getNextValidIndex()>=0}rollback(){const t=this.getPreviousValidIndex();return-1!==t&&(this.readOnlyLock(),this.#et=t,this.#tt[t].reveal(),this.releaseReadOnlyLock(),!0)}rollover(){const t=this.getNextValidIndex();return-1!==t&&(this.readOnlyLock(),this.#et=t,this.#tt[t].reveal(),this.releaseReadOnlyLock(),!0)}}});var qe=Object.freeze({__proto__:null,StringOutputStream:class{#nt;constructor(){this.#nt=""}async write(t){this.#nt+=t}async close(){}data(){return this.#nt}}});class Ye{#it;#at;#ot;#lt;#ht;#ct;#ut;constructor(t){this.#at=0,this.#ut=t,this.clear()}static newStringTrie(){return new Ye({empty:()=>"",append:(t,e)=>t+e,slice:(t,e,r)=>t.slice(e,r)})}static newArrayTrie(){return new Ye({empty:()=>[],append:(t,e)=>t.concat([e]),slice:(t,e,r)=>t.slice(e,r)})}add(t){let e=this.#at;++this.#ht[this.#at];for(let r=0;r<t.length;++r){const s=t[r];let n=this.#ot[e].get(s);n||(this.#ct.length?n=this.#ct.pop():(n=this.#it++,this.#lt.push(!1),this.#ht.push(0),this.#ot.push(new Map)),this.#ot[e].set(s,n)),++this.#ht[n],e=n}this.#lt[e]=!0}remove(t){if(!this.has(t))return!1;let e=this.#at;--this.#ht[this.#at];for(let r=0;r<t.length;++r){const s=t[r],n=this.#ot[e].get(s);--this.#ht[n]||(this.#ot[e].delete(s),this.#ct.push(n)),e=n}return this.#lt[e]=!1,!0}has(t){let e=this.#at;for(let r=0;r<t.length;++r)if(e=this.#ot[e].get(t[r]),!e)return!1;return this.#lt[e]}words(t){t=t??this.#ut.empty();let e=this.#at;for(let r=0;r<t.length;++r)if(e=this.#ot[e].get(t[r]),!e)return[];const r=[];return this.dfs(e,t,r),r}dfs(t,e,r){this.#lt[t]&&r.push(e);const s=this.#ot[t];for(const[t,n]of s){const s=this.#ut.append(e,t);this.dfs(n,s,r)}}longestPrefix(t,e){let r=this.#at,s=0;for(let n=0;n<t.length&&(r=this.#ot[r].get(t[n]),r);++n)e&&!this.#lt[r]||(s=n+1);return this.#ut.slice(t,0,s)}clear(){this.#it=1,this.#at=0,this.#ot=[new Map],this.#lt=[!1],this.#ht=[0],this.#ct=[]}}var Ze=Object.freeze({__proto__:null,Trie:Ye});var Ke=Object.freeze({__proto__:null,TextDictionary:class{words;index;constructor(){this.words=new Map,this.index=Ye.newStringTrie()}addWord(t){let e=this.words.get(t)||0;++e,this.words.set(t,e),this.index.add(t)}removeWord(t){let e=this.words.get(t)||0;if(e){if(1===e)return this.words.delete(t),void this.index.remove(t);--e,this.words.set(t,e)}}wordsWithPrefix(t){return this.index.words(t)}hasWord(t){return this.words.has(t)}wordCount(t){return this.words.get(t)||0}reset(){this.words.clear(),this.index.clear()}}});var Je=Object.freeze({__proto__:null,Throttler:class{#gt;#dt;#pt;#mt;#yt;#ft;#wt;#bt;constructor(t){this.#gt=t,this.#dt=!1,this.#pt=!1,this.#mt=null,this.#yt=0,this.#ft=new Promise((t=>{this.#wt=t}))}processCompleted(){this.#yt=this.getTime(),this.#dt=!1,this.#mt&&this.innerSchedule(!1),this.processCompletedForTests()}processCompletedForTests(){}get process(){return this.#mt}onTimeout(){this.#bt=void 0,this.#pt=!1,this.#dt=!0,Promise.resolve().then(this.#mt).catch(console.error.bind(console)).then(this.processCompleted.bind(this)).then(this.#wt),this.#ft=new Promise((t=>{this.#wt=t})),this.#mt=null}schedule(t,e){this.#mt=t;const r=Boolean(this.#bt)||this.#dt,s=this.getTime()-this.#yt>this.#gt,n=(e=Boolean(e)||!r&&s)&&!this.#pt;return this.#pt=this.#pt||e,this.innerSchedule(n),this.#ft}innerSchedule(t){if(this.#dt)return;if(this.#bt&&!t)return;this.#bt&&this.clearTimeout(this.#bt);const e=this.#pt?0:this.#gt;this.#bt=this.setTimeout(this.onTimeout.bind(this),e)}clearTimeout(t){clearTimeout(t)}setTimeout(t,e){return window.setTimeout(t,e)}getTime(){return window.performance.now()}}});var Qe=Object.freeze({__proto__:null,WasmDisassembly:class{lines;#St;#xt;constructor(t,e,r){if(t.length!==e.length)throw new Error("Lines and offsets don't match");this.lines=t,this.#St=e,this.#xt=r}get lineNumbers(){return this.#St.length}bytecodeOffsetToLineNumber(t){return e.ArrayUtilities.upperBound(this.#St,t,e.ArrayUtilities.DEFAULT_COMPARATOR)-1}lineNumberToBytecodeOffset(t){return this.#St[t]}*nonBreakableLineNumbers(){let t=0,e=0;for(;t<this.lineNumbers;){if(e<this.#xt.length){if(this.lineNumberToBytecodeOffset(t)>=this.#xt[e].start){t=this.bytecodeOffsetToLineNumber(this.#xt[e++].end)+1;continue}}yield t++}}}});class tr{#Tt;#Rt;constructor(t){this.#Tt=new Promise((e=>{const r=new Worker(t,{type:"module"});r.onmessage=t=>{console.assert("workerReady"===t.data),r.onmessage=null,e(r)}}))}static fromURL(t){return new tr(t)}postMessage(t){this.#Tt.then((e=>{this.#Rt||e.postMessage(t)}))}dispose(){this.#Rt=!0,this.#Tt.then((t=>t.terminate()))}terminate(){this.dispose()}set onmessage(t){this.#Tt.then((e=>{e.onmessage=t}))}set onerror(t){this.#Tt.then((e=>{e.onerror=t}))}}var er=Object.freeze({__proto__:null,WorkerWrapper:tr});let rr;export{s as App,i as AppProvider,l as Base64,h as CharacterIdMap,zt as Color,I as ColorConverter,U as ColorUtils,Xt as Console,Ft as Debouncer,Dt as EventTarget,Ut as JavaScriptMetaData,Ht as Lazy,Zt as Linkifier,Kt as Mutex,It as ObjectWrapper,te as ParsedURL,re as Progress,se as QueryParamHandler,ne as ResolverBase,me as ResourceType,Nt as Revealer,we as Runnable,Se as SegmentedRange,Ce as SettingRegistration,$e as Settings,He as SimpleHistoryManager,qe as StringOutputStream,Ke as TextDictionary,Je as Throttler,Ze as Trie,Qe as WasmDisassembly,er as Worker,rr as settings};
